diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-13 13:28:41 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-13 13:28:41 +0400 |
commit | 10c0cb8ca763861b8c636ccece7278407650f1c8 (patch) | |
tree | bc337f1501818f877f30222f971f434a8a87d817 /db/migrate/20140313092127_migrate_already_imported_projects.rb | |
parent | 44c940391701c8ac6715a90a707db0c255e016d9 (diff) |
Add migration for already imported projects
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db/migrate/20140313092127_migrate_already_imported_projects.rb')
-rw-r--r-- | db/migrate/20140313092127_migrate_already_imported_projects.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/db/migrate/20140313092127_migrate_already_imported_projects.rb b/db/migrate/20140313092127_migrate_already_imported_projects.rb new file mode 100644 index 00000000000..f4392c0f05e --- /dev/null +++ b/db/migrate/20140313092127_migrate_already_imported_projects.rb @@ -0,0 +1,12 @@ +class MigrateAlreadyImportedProjects < ActiveRecord::Migration + def up + Project.where(imported: true).update_all(import_status: "finished") + Project.where(imported: false).update_all(import_status: "none") + remove_column :projects, :imported + end + + def down + add_column :projects, :imported, :boolean, default: false + Project.where(import_status: 'finished').update_all(imported: true) + end +end |