{"repo":"scenic-views/scenic","free":true,"listed":false,"github":"https://github.com/scenic-views/scenic","clone":"git clone https://github.com/scenic-views/scenic.git","description":"Versioned database views for Rails","language":"Ruby","stars":3623,"topics":["ruby","sql","rails","schema","postgres","database","activerecord","hacktoberfest","database-views"],"license":"MIT","category":"databases-storage","readme_excerpt":"Scenic Scenic adds methods to ActiveRecord::Migration to create and manage database views in Rails. Using Scenic, you can bring the power of SQL views to your Rails application without having to switch your schema format to SQL. Scenic provides a convention for versioning views that keeps your migration history consistent and reversible and avoids having to duplicate SQL strings across migrations. As an added bonus, you define the structure of your view in a SQL file, meaning you get full SQL syntax highlighting in the editor of your choice and can easily test your SQL in the database console during development. Scenic ships with support for PostgreSQL. The adapter is configurable (see Scenic::Configuration ) and has a minimal interface (see Scenic::Adapters::Postgres ) that other gems can provide. So how do I install this? If you're using Postgres, Add gem \"scenic\" to your Gemfile and run bundle install . If you're using something other than Postgres, check out the available third-party adapters. Great, how do I create a view? You've got this great idea for a view you'd like to call search results . You can create the migration and the corresponding view definition file with the following command: Edit the db/views/search results v01.sql file with the SQL statement that defines your view. In our example, this might look something like this: The generated migration will contain a create view statement. Run the migration, and [baby, you got a view going][carl]. The migration i","default_branch":null,"files":null,"tree":[],"storefront":"/r/scenic-views","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/scenic-views/scenic/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}