SchemaPlus::Tables adds useful features to ActiveSupport's handling of tables. (Actually, only one for now)
SchemaPlus::Tables is part of the SchemaPlus family of Ruby on Rails extension gems.
As usual:
gem "schema_plus_tables" # in a Gemfile
gem.add_dependency "schema_plus_tables" # in a .gemspec
SchemaPlus::Tables adds the if_exists:
option:
ActiveRecord::Migration.drop_table "table_name", if_exists: true
SchemaPlus 1.8.x provided some options and accessors that are now available in ActiveRecord 4.2, but in slightly different form. SchemaPlus::Tables still supports the SchemaPlus 1.8.x form but issues deprecation warnings in favor of the rails form:
Migration.drop_table
deprecates optioncascade: true
=>force: :cascade
SchemaPlus::Tables is tested on:
- ruby 2.1.5 with activerecord 4.2, using mysql2, sqlite3 or postgresql
- 0.1.1 - Update schema_plus_core and schema_dev dependencies
- 0.1.0 - Initial release, extracted from SchemaPlus 1.x
Are you interested in contributing to SchemaPlus::Tables? 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::Tables 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 travis-ci
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_plus_core: SchemaPlus::Tables uses the SchemaPlus::Core API that provides middleware callback stacks to make it easy to extend ActiveRecord's behavior. If that API is missing something you need for your contribution, please head over to schema_plus_core and open an issue or pull request.
- schema_monkey: SchemaPlus::Tables is implemented as a schema_monkey client, using schema_monkey's convention-based protocols for extending ActiveRecord and using middleware stacks.