{"id":22958201,"url":"https://github.com/akiomik/scenic-cascade","last_synced_at":"2026-04-24T16:36:23.613Z","repository":{"id":211516806,"uuid":"511893948","full_name":"akiomik/scenic-cascade","owner":"akiomik","description":"A scenic migration file generator that supports cascading view updates","archived":false,"fork":false,"pushed_at":"2024-05-17T01:19:48.000Z","size":150,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-17T02:32:53.559Z","etag":null,"topics":["dependency-graph","materialized-view","rails","ruby-on-rails","scenic","view"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akiomik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["akiomik"],"patreon":null,"open_collective":null,"ko_fi":"akiomik","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-07-08T12:50:55.000Z","updated_at":"2024-08-02T04:57:29.394Z","dependencies_parsed_at":"2023-12-11T07:43:40.147Z","dependency_job_id":"f6027c44-a2f7-48ef-89e7-51dc11b9843f","html_url":"https://github.com/akiomik/scenic-cascade","commit_stats":null,"previous_names":["akiomik/scenic-dependencies"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiomik%2Fscenic-cascade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiomik%2Fscenic-cascade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiomik%2Fscenic-cascade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiomik%2Fscenic-cascade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akiomik","download_url":"https://codeload.github.com/akiomik/scenic-cascade/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741174,"owners_count":20826063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-graph","materialized-view","rails","ruby-on-rails","scenic","view"],"created_at":"2024-12-14T17:37:12.372Z","updated_at":"2026-04-24T16:36:23.558Z","avatar_url":"https://github.com/akiomik.png","language":"Ruby","funding_links":["https://github.com/sponsors/akiomik","https://ko-fi.com/akiomik"],"categories":[],"sub_categories":[],"readme":"# scenic-cascade\n\n[![Gem Version](https://badge.fury.io/rb/scenic-cascade.svg)](https://badge.fury.io/rb/scenic-cascade)\n[![Ruby](https://github.com/akiomik/scenic-cascade/actions/workflows/ci.yml/badge.svg)](https://github.com/akiomik/scenic-cascade/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/akiomik/scenic-cascade/graph/badge.svg?token=SEHF4ZDZIY)](https://codecov.io/gh/akiomik/scenic-cascade)\n\n`scenic-cascade` is a [scenic](https://github.com/scenic-views/scenic) migration file generator that supports cascading view updates.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'scenic-cascade'\n```\n\nAnd then execute:\n\n```shell-session\n$ bundle install\n```\n\nOr install it yourself as:\n\n```shell-session\n$ gem install scenic-cascade\n```\n\n## Usage\n\nTo generate migration files, use `scenic:view:cascade` generator instead of `scenic:view`.\nThe following example generates migration files for `search_results` view.\n\n```shell-session\n$ bin/rails generate scenic:view:cascade search_results\n      create db/views/search_results_v01.sql\n      create db/migrate/20220714233704_create_search_results.rb\n```\n\n## How it works\n\nConsider a situation where the following three views exist:\n\n* `first_results` is a parent view (version 1)\n* `second_results` is a materialized view that depends on `first_results` (version 3)\n* `third_results` is a view that depends on `first_results` and `second_results` (version 2)\n\n```sql\n-- first_results\nSELECT 'foo' AS bar;\n\n-- second_results\nSELECT * FROM first_results;\n\n-- third_results\nSELECT * FROM first_results UNION SELECT * FROM second_results;\n```\n\nExecuting the `scenic:view:cascade` generator for `first_results` in this state will generate the following migration file:\n\n```shell-session\n$ bin/rails generate scenic:view:cascade first_results\n      create db/views/first_results_v02.sql\n      create db/migrate/20220714233704_update_first_results_to_version_2.rb\n```\n\nSince all dependencies are described, you can execute `bin/rails db:migrate` without changing the migration file.\n\n\u003e [!WARNING]\n\u003e Currently, index re-creation is not supported.\n\u003e Please change a migration file to recreate indexes if it contains `drop_view` for materialized views.\n\n```ruby\nclass UpdateSearchResultsToVersion2 \u003c ActiveRecord::Migration\n  def change\n    drop_view :third_results, revert_to_version: 2, materialized: false\n    drop_view :second_results, revert_to_version: 3, materialized: true\n    replace_view :first_results, version: 2, revert_to_version: 1\n    create_view :second_results, version: 3, materialized: true\n    create_view :third_results, version: 2, materialized: false\n  end\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/akiomik/scenic-cascade. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/akiomik/scenic-cascade/blob/main/CODE_OF_CONDUCT.md).\n\n## Code of Conduct\n\nEveryone interacting in the `scenic-cascade' project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/akiomik/scenic-cascade/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakiomik%2Fscenic-cascade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakiomik%2Fscenic-cascade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakiomik%2Fscenic-cascade/lists"}