SchemaPlus / schema_plus

SchemaPlus provides a collection of enhancements and extensions to ActiveRecord
Other
679 stars 84 forks source link

New gem request: Support arbitrary per-table and/or per-column metadata in schema #232

Open ronen opened 8 years ago

ronen commented 8 years ago

It could be very useful to support specifying arbitrary per-table and/or per-column metadata as part of a migration, in a manner that will be queryable and included in the dump.

The schema_associations and schema_validations gems could make use of such a capability, to be able to specify additional parameters or options (or suppression of) associations and validations that are generated based on the db, to avoid needing to do that in the model definition, in the name of keeping things more DRY.

This could perhaps be implemented via a JSON-encoded string in a postgresql or mysql COMMENT, but that could run up against string length limits. Another option would be to maintain a "schema_metadata" table (analogous to the schema_migrations table that rails maintains) with columns table_name, column_name (optional), and data (JSON).