Awesome
SchemaPlus::Tables
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.
Installation
<!-- SCHEMA_DEV: TEMPLATE INSTALLATION - begin --> <!-- These lines are auto-inserted from a schema_dev template -->As usual:
gem "schema_plus_tables" # in a Gemfile
gem.add_dependency "schema_plus_tables" # in a .gemspec
<!-- SCHEMA_DEV: TEMPLATE INSTALLATION - end -->
Usage
drop_table if exists
SchemaPlus::Tables adds the if_exists:
option:
ActiveRecord::Migration.drop_table "table_name", if_exists: true
Deprecations
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
Compatibility
SchemaPlus::Tables is tested on:
<!-- SCHEMA_DEV: MATRIX - begin --> <!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->- ruby 2.1.5 with activerecord 4.2, using mysql2, sqlite3 or postgresql
History
- 0.1.1 - Update schema_plus_core and schema_dev dependencies
- 0.1.0 - Initial release, extracted from SchemaPlus 1.x
Development & Testing
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: TEMPLATE USES SCHEMA_DEV - begin --> <!-- These lines are auto-inserted from a schema_dev template -->-
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.