Popularity
5.3
Stable
Activity
0.0
Stable
691
22
88

Description

The SchemaPlus family of gems provide various extensions and enhancements to ActiveRecord >= 4.2. There are two varieties:

Code Quality Rank: L4
Monthly Downloads: 1,465
Programming language: Ruby
License: MIT License
Latest version: v2.0.1

SchemaPlus alternatives and similar gems

Based on the "Database Tools" category.
Alternatively, view SchemaPlus alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of SchemaPlus or a related project?

Add another 'Database Tools' Gem

README

SchemaPlus family

The SchemaPlus family of gems provide various extensions and enhancements to ActiveRecord >= 4.2. There are two varieties:

  • Gems that provide new default automatic behavior

    These gems run with the spirit of DRY and convention over configuration -- and automatically take care of things for you. Just include any of these gems and they'll get to work.

    Gem Description
    schema_associations DRY up your models! Why manually define associations (and their inverses) in the models, when you've already defined those relations in the database?
    schema_auto_foreign_keys DRY up your migrations! It goes without saying that a foreign key relationship should have a foreign key constraint -- it should also go without typing.
    schema_validations DRY up your validations! The database has constraints in it, your models should automatically validate based on those constraints.
  • Gems that extend ActiveRecord's feature set

    These gems provide new features and capabilities to ActiveRecord that you may wish to take advantage of. None of these have default automagic; once you include the gem the new features are available, but you need to invoke them to use them.

    Gem Description
    schema_plus_columns Column attributes including column.indexes and column.unique?
    schema_plus_db_default Use ActiveRecord::DB_DEFAULT to set an attribute to the database default
    schema_plus_default_expr Use SQL expressions for database default values
    schema_plus_enums Define enum types in migrations
    schema_plus_foreign_keys Extended support for foreign keys, including creation as column options, :deferrable, and SQLite3 support
    schema_plus_indexes Convenience and consistency in using indexes
    schema_plus_multischema Support for using multiple PostgreSQL schemas in a single database
    schema_plus_pg_indexes PostgreSQL index features: case_insensitive, expression and operator_class
    schema_plus_tables Convenience and consistency in using tables
    schema_plus_views Create and drop views in migrations

See detailed documentation in each gem's README.

Is there some other capability you wish SchemaPlus had a gem for? Open an issue here. Or try implementing it yourself -- creating ActiveRecord extensions is easy and fun using SchemaPlus's tools schema_monkey and schema_plus_core!!


The schema_plus gem

Gem Version Build Status Coverage Status Dependency Status

The schema_plus gem (v2.0) is a wrapper that pulls in a collection of gems from the SchemaPlus family. For the most part we recommend skipping this gem and directly including the specific feature gems you're interested in using.

This wrapper is mostly provided for easy upgrade for those who were using schema_plus v1.8, which was a single monolothic gem. This wrapper pulls in the gems that provide the same set of features and automatic behavior as the previous version:

Note that the earlier version (1.x) supports earlier versions of ActiveRecord: 3.1, 4.0, 4.1, and 4.2.0. For more info about that version, see the schema_plus 1.x branch README.

Upgrading from schema_plus 1.8.x

schema_plus 2.0 intends to be a completely backwards-compatible drop-in replacement for SchemaPlus 1.8.x, through restricted to ActiveRecord >= 4.2 and Ruby >= 2.1

If you find any incompatibilities, please report an issue!

Deprecations

In cases where ActiveRecord 4.2 has introduced features previously supported only by SchemaPlus, but using different names, the SchemaPlus 2.0 family of gems now issue deprecation warnings in favor of the rails form. The complete list of deprecations:

  • Index definition deprecates these options:

    • :conditions => :where
    • :kind => :using
  • drop_table deprecates this option:

    • cascade: true => force: :cascade
  • Foreign key definitions deprecate options to :on_update and :on_delete:

    • :set_null => :nullify
  • add_foreign_key and remove_foreign_key deprecate the method signature:

    • (from_table, columns, to_table, primary_keys, options) => (from_table, to_table, options)
  • ForeignKeyDefinition deprecates accessors:

    • #table_name in favor of #from_table
    • #column_names in favor of Array.wrap(#column)
    • #references_column_names in favor of #primary_key
    • #references_table_name in favor of#to_table`
  • IndexDefinition deprecates accessors:

    • #conditions in favor of #where
    • #kind in favor of #using.to_s

Compatibility

SchemaPlus 2.x is tested against all combinations of:

<!-- 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.0, using mysql2, sqlite3 or postgresql
  • ruby 2.1.5 with activerecord 4.2.1, using mysql2, sqlite3 or postgresql

<!-- SCHEMA_DEV: MATRIX - end -->

Installation

Install from http://rubygems.org via

$ gem install "schema_plus"

or in a Gemfile

gem "schema_plus"

History

  • See [CHANGELOG](CHANGELOG.md) for per-version release notes.

  • SchemaPlus was originally derived from several "Red Hill On Rails" plugins created by @harukizaemon

  • SchemaPlus was created in 2011 by @mlomnicki and @ronen

  • And lots of contributors since then.

  • In 2015, the monolithic schema_plus gem was split into the SchemaPlus family of specific feature gems.