Sha256: 02b67e39fd782ee28eeaa69b2ef10ef3af93d3d4866ae9ae109cb26c3db5cfe4
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
AlsoMigrate =========== Migrate multiple tables with similar schema at once. Requirements ------------ <pre> gem install also_migrate </pre> Define the model ---------------- <pre> class Article < ActiveRecord::Base also_migrate( :article_archives, :add => [ # Parameters to ActiveRecord::ConnectionAdapters::SchemaStatements#add_column [ 'deleted_at', :datetime, {} ] ], :subtract => 'restored_at', :ignore => 'deleted_at', :indexes => 'id' ) end </pre> Options: * <code>add</code> Create columns that the original table doesn't have (defaults to none) * <code>subtract</code> Exclude columns from the original table (defaults to none) * <code>ignore</code> Ignore migrations that apply to certain columns (defaults to none) * <code>indexes</code> Only index certain columns (duplicates all indexes by default) That's it! ---------- Next time you migrate, <code>article_archives</code> is created if it doesn't exist. Any new migration applied to <code>articles</code> is automatically applied to <code>article_archives</code>.
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
also_migrate-0.3.4 | README.md |
also_migrate-0.3.3 | README.md |
also_migrate-0.3.2 | README.md |