Sha256: 049a43653e31d61e3d3e2a8867e9a30c564e4296d8fec27e0c8d1f31e7b3a809
Contents?: true
Size: 1.55 KB
Versions: 5
Compression:
Stored size: 1.55 KB
Contents
Description: Stubs out a new (second)database migration. Pass the migration name, either CamelCased or under_scored, and an optional list of attribute pairs as arguments. For your organizational convenience, a migration class is generated in db/migrate/secondbase prefixed by a timestamp of the current date and time. You can name your migration in either of these formats to generate add/remove column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFromTable Example: `rails generate secondbase_migration AddSslFlag` If the current date is May 14, 2008 and the current time 09:09:12, this creates the AddSslFlag migration db/migrate/secondbase/20080514090912_add_ssl_flag.rb `rails generate secondbase_migration AddTitleBodyToPost title:string body:text published:boolean` This will create the AddTitleBodyToPost in db/migrate/secondbase/20080514090912_add_title_body_to_post.rb with this in the Up migration: add_column :posts, :title, :string add_column :posts, :body, :text add_column :posts, :published, :boolean And this in the Down migration: remove_column :posts, :published remove_column :posts, :body remove_column :posts, :title You can continue to use `rake db:migrate` to migrate your first and second databases, or you can target secondbase by using `rake db:migrate:secondbase`. Remember, your migrations are timestamped, so regardless of the database they target, they will be unique and you will not have collision issues.
Version data entries
5 entries across 5 versions & 1 rubygems