Repository is archived
Low commit activity in last 3 years
No release in over a year
Compatibility helpers for the SchemaPlus family of gems
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0
~> 13.0
~> 4.2.0

Runtime

>= 5.2, < 7.1
 Project Readme

Gem Version Build Status Coverage Status

Deprecation notice

This gem is officially deprecated and will no longer be maintained.

Newer Active record versions correclty ignore views from the connection.tables list so this gem is no longer needed. Also as we are only supporting AR 5.2+ there is no need for the "latest_version" method either.

SchemaPlus::Compatibility

SchemaPlus::Compatibility provides compatibility support for developing and testing using different versions of ActiveRecord.

SchemaPlus::Compatibility is part of the SchemaPlus family of Ruby on Rails ActiveRecord extension gems.

Installation

As usual:

gem "schema_plus_compatibility"                # in a Gemfile
gem.add_dependency "schema_plus_compatibility" # in a .gemspec

Usage

SchemaPlus::Compatibility provides the following new methods:

  • connection.tables_only

    In AR 5.0, connection.tables is deprecated for some db adapters, and in AR 4.2 it may actually returns views (if any are defined) as well. This method consistently returns just tables regardless of the ActiveRecord version.

  • connection.user_tables_only

    In AR 5.0, an internal table (ActiveRecord::InternalMetadata.table_name) is added by ActiveRecord. The existence of this table trips up some tests (and possibly real code) which doesn't expect to see it. This method returns all tables except the internal metadata table.

  • Migration.latest_version

    In AR 5.0, ActiveRecord::Migration is versioned using []; in AR 4.2 it's not versioned, making it awkward to create migrations cross-version. This method returns the latest migration version in both AR 4.2 and AR 5.0.

Note that the methods provided by SchemaPlus::Compatibility are subject to arbitrary change if/when SchemaPlus supports new versions of AR and/or drops support for old versions. But SchemaPlus::Compatibility will of course follow semantic versioning.

Compatibility

SchemaPlus::Compatibility is tested on:

  • ruby 2.5 with activerecord 5.2, using mysql2, sqlite3 or postgresql:9.6
  • ruby 2.5 with activerecord 6.0, using mysql2, sqlite3 or postgresql:9.6
  • ruby 2.5 with activerecord 6.1, using mysql2, sqlite3 or postgresql:9.6
  • ruby 2.7 with activerecord 5.2, using mysql2, sqlite3 or postgresql:9.6
  • ruby 2.7 with activerecord 6.0, using mysql2, sqlite3 or postgresql:9.6
  • ruby 2.7 with activerecord 6.1, using mysql2, sqlite3 or postgresql:9.6
  • ruby 2.7 with activerecord 7.0, using mysql2, sqlite3 or postgresql:9.6
  • ruby 3.0 with activerecord 6.0, using mysql2, sqlite3 or postgresql:9.6
  • ruby 3.0 with activerecord 6.1, using mysql2, sqlite3 or postgresql:9.6
  • ruby 3.0 with activerecord 7.0, using mysql2, sqlite3 or postgresql:9.6
  • ruby 3.1 with activerecord 6.0, using mysql2, sqlite3 or postgresql:9.6
  • ruby 3.1 with activerecord 6.1, using mysql2, sqlite3 or postgresql:9.6
  • ruby 3.1 with activerecord 7.0, using mysql2, sqlite3 or postgresql:9.6

Release Notes

  • 1.0.1 - Add AR 7.0 support and deprecate gem.
  • 1.0.0 - Drop AR < 5.2 and add 6.0 and 6.1 support
  • 0.4.0 - Allow AR 5.2
  • 0.3.0 - Allow AR 5.1
  • 0.2.0 - Replace the ill-defined connection.tables_without_deprecation with connection.tables_only which truly returns solely tables.
  • 0.1.0 - Initial release

Development & Testing

Are you interested in contributing to SchemaPlus::Compatibility? Thanks! Please follow the standard protocol: fork, feature branch, develop, push, and issue pull request.

Some things to know about to help you develop and test:

  • schema_dev: SchemaPlus::Compatibility uses schema_dev to facilitate running rspec tests on the matrix of ruby, activerecord, and database versions that the gem supports, both locally and on github actions

    To to run rspec locally on the full matrix, do:

      $ schema_dev bundle install
      $ schema_dev rspec
    

    You can also run on just one configuration at a time; For info, see schema_dev --help or the schema_dev README.

    The matrix of configurations is specified in schema_dev.yml in the project root.

  • schema_monkey: SchemaPlus::Compatibility is implemented as a schema_monkey client, using schema_monkey's convention-based protocols for extending ActiveRecord and using middleware stacks.