没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
oss.trustie.net/open_source_projects | 主页 > 开源项目社区 > smooth-migration |
smooth-migration
|
0 | 0 | 5 |
贡献者 | 讨论 | 代码提交 |
Smooth Migration PluginThe Smooth Migration plugin allows database migrations to continue running instead of aborting on failure. The rake db:migrate task will fail at the end of the migration instead of in the middle. This helps prevent getting stuck between migrations and needing to comment out code to continue migrating.
RequirementsRails >= 1.2 InstallationThe traditional way:
ruby script/plugin install http://smooth-migration.googlecode.com/svn/trunk/smooth_migration/
Or with piston:
piston import http://smooth-migration.googlecode.com/svn/trunk/smooth_migration/ vendor/plugins/smooth_migration
ExampleBefore Smooth Migration CreateSomeTable: migrating ===============================================
-- create_table(:users)
> 0.0039s add_column(:users, :email, :string)
-
> 0.0075s add_column(:table_does_not_exist, :foo, :string)
-
rake aborted!
SQLite3::SQLException: no such table: table_does_not_exist: ALTER TABLE table_does_not_exist ADD 'foo' varchar(255)In this example, the migration created the users table, but then failed when attempting to
add a column to a table that does not exist. One problem is that your database is still on the
previous schema version, so the next time you try to migrate, it will fail on creating the users table.
After Smooth Migration CreateSomeTable: migrating ===============================================
-- create_table(:users)
> 0.0042s add_column(:users, :email, :string)
-
> 0.3769s add_column(:table_does_not_exist, :foo, :string)
-
> ActiveRecord::StatementInvalid add_column(:users, :bar, :string)
-> SQLite3::SQLException: no such table: table_does_not_exist: ALTER TABLE table_does_not_exist ADD 'foo' varchar(255)
-
-> 0.0081s
CreateSomeTable: migrated (0.3910s) ======================================
rake aborted!
-- 1 Failures! Review console output.The exception messages are displayed inline and the migration continues. At the end of the migration
an exception is thrown to abort the rake task and a failure notice is displayed.
UsageYour migrations will become smooth after installing the plugin. If you want to migrate the old way, use:
rake db:migrate SMOOTH=false Or, in your environment configuration file:
SmoothMigration.disabled = trueCopyright (c) 2007 Dan Manges, released under the MIT license.