# scenic-views/scenic

Versioned database views for Rails

Repository: https://github.com/scenic-views/scenic
Canonical: https://ross.abutalabs.com/products/scenic-views-scenic
Homepage: https://thoughtbot.com/blog/announcing-scenic--versioned-database-views-for-rails
Language: Ruby
License: MIT
License Family: permissive
Topics: ruby, sql, rails, schema, postgres, database, activerecord, hacktoberfest, database-views
Last push: 2026-06-29T17:22:34+00:00

## Health v2 (maintenance only)
Score: 63/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 90, release rhythm 8, longevity 100
- inputs: {"age_days": 4509, "days_push": 65, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3623, forks 241 (observed 2026-08-28T04:08:11.914599+00:00)

## What it is
Scenic is a Ruby gem that adds methods to ActiveRecord::Migration for creating and managing versioned database views in Rails applications. It lets developers define views in SQL files with a convention for versioning that keeps migrations reversible and consistent, shipping with PostgreSQL support and a configurable adapter interface.

## Use cases
- manage versioned SQL database views in a Rails app
- create and update Postgres views through Rails migrations
- use database views without switching schema format to SQL
- implement full-text search across multiple models with a SQL view
- build complex reports by encapsulating SQL in views
- keep view definitions in SQL files with syntax highlighting and easy testing

## When to choose
- you use Rails with PostgreSQL and want first-class database view support
- you need reversible, versioned migrations for view changes
- you want to express complex queries as composable database views instead of ActiveRecord scopes

## When to avoid
- your application does not use Rails or ActiveRecord
- you use MySQL, SQLite, or another database without a third-party Scenic adapter
- you prefer managing views manually outside your migration history

## Facets
- artifact type: library
- maturity: stable
- function: database, orm, developer-tools
- domain: databases, web-development, backend, developer-tools
- platform: ruby
- tags: rails, activerecord, database-views, postgres, sql, migrations, schema, web-server

## Member repositories
- scenic-views/scenic (main) score 63

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:11.914599+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:31:56.898856+00:00, confidence not recorded.
  - readme: https://github.com/scenic-views/scenic (fetched 2026-08-28T04:08:11.914599+00:00, sha 1f91c8cf0245)
  - homepage: https://thoughtbot.com/blog/announcing-scenic--versioned-database-views-for-rails (fetched 2026-08-29T09:26:34.011343+00:00, sha b53aa0488d01)
  - site_page: https://thoughtbot.com/services (fetched 2026-08-29T09:26:34.017661+00:00, sha 5b152b8c27da)
  - site_page: https://thoughtbot.com/services/ruby-on-rails-development (fetched 2026-08-29T09:26:34.019533+00:00, sha 9db22fa0af46)
- Data as of 2026-08-30T08:39:29.467469+00:00.
