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).
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 theschema_migrations
table that rails maintains) with columnstable_name
,column_name
(optional), anddata
(JSON).