The noteworthy changes for each VersionedDatabaseFunctions version are included here. For a complete changelog, see the CHANGELOG for each version via the version links.
1.4.1 - December 15, 2017
- View migrations created under Rails 5 and newer will use the current migration
version in the generated migration class rather than always using
5.0
.
1.4.0 - May 11, 2017
refresh_materialized_view
now accepts acascade
option, which defaults tofalse
. Setting this option totrue
will refresh any materialized views the current view depends on first, ensuring the view being refreshed has the most up-to-date information.sql_definition
argument is now supported when usingupdate_view
.
- View migrations created under Rails 5 and newer will no longer result in warnings.
ar_internal_metadata
is no longer included in the schema dump for Rails 5 and newer apps.- Using the
versioned_database_functions:model
generator will no longer create a fixture or factory.
1.3.0 - May 27, 2016
- Add
replace_view
migration statement, which issuesCREATE OR REPLACE VIEW
rather thanCREATE VIEW
orDROP VIEW
andCREATE VIEW
. - Schema-qualify views outside the 'public' namespace, such as
versioned_database_functions.searches
- Singularize generated model name when injecting into class. Previously, pluralized names would issue a warning and VersionedDatabaseFunctions would attempt to insert model code into the pluralized model file.
- Convert shell-based smoke tests to RSpec syntax.
1.2.0 - February 5, 2016
- The generators now accept namespaced view definitions. For example:
rails generate versioned_database_functions:view my_app.users
.
- Materialized view indexes are now properly dumped to
db/schema.rb
. This was an oversight in previous releases, meaningrake db:schema:load
was missing indexes. - Calling
update_view
for a materialized view now properly finds associated indexes for automatic reapplication. An issue in the previous index query was returning no indexes.
Note: Dumping materialized view indexes will produce an invalid
db/schema.rb
file under Rails 5 beta 1 and beta 2. This is fixed on Rails
master.
1.1.1 - January 29, 2016
- Some schema operations were failing with a
PG::ConnectionBad: connection is closed
error. This has been fixed by ensuring we grab a fresh connection for all operations.
1.1.0 - January 8, 2016
- Added support for updating materialized view definitions while maintaining existing indexes that are still applicable after the update.
- Added support for refreshing materialized views concurrently (requires Postgres 9.4 or newer).
- The schema dumper will now dump views and materialized views together in the
order they are returned by Postgres. This fixes issues when loading views that
depend on other views via
rake db:schema:load
. - VersionedDatabaseFunctions now works on supported versions of Postgres older than 9.3.0. Attempts to use database features not supported by your specific version of Postgres will raise descriptive errors.
- Fixed inability to dump materialized views in Rails 5.0.0.beta1.
1.0.0 - November 23, 2015
- Added support for materialized views.
- Allow changing the database adapter via
VersionedDatabaseFunctions::Configuration
.
- Improved formatting of the view when dumped to
schema.rb
. - Fixed generation of namespaced models by using ActiveRecord's own model generator.
- Eliminated
alias_method_chain
deprecation when running with Rails master (5.0).
0.3.0 - January 23, 2015
- Previous view definition is copied into new view definition file when updating an existing view.
- We avoid dumping views that belong to Postgres extensions.
db/schema.rb
is prettier thanks to a blank line after each view definition.
0.2.1 - January 5, 2015
- View generator will now create
db/views
directory if necessary.
0.2.0 - August 11, 2014
- Teach view generator to update existing views.
- Raise an error if view definition is empty.
0.1.0 - August 4, 2014
VersionedDatabaseFunctions makes it easier to work with Postgres views in Rails.
It introduces view methods to ActiveRecord::Migration and allows views to be dumped to db/schema.rb. It provides generators for models, view definitions, and migrations. It is built around a basic versioning system for view definition files.
In short, go add a view to your app.