diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20140312145357_add_import_status_to_project.rb | 5 | ||||
-rw-r--r-- | db/migrate/20140313092127_migrate_already_imported_projects.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 4 |
3 files changed, 19 insertions, 2 deletions
diff --git a/db/migrate/20140312145357_add_import_status_to_project.rb b/db/migrate/20140312145357_add_import_status_to_project.rb new file mode 100644 index 00000000000..ef972e8342a --- /dev/null +++ b/db/migrate/20140312145357_add_import_status_to_project.rb @@ -0,0 +1,5 @@ +class AddImportStatusToProject < ActiveRecord::Migration + def change + add_column :projects, :import_status, :string + end +end 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 diff --git a/db/schema.rb b/db/schema.rb index e07fd3deaca..d8a9d1863fc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140305193308) do +ActiveRecord::Schema.define(version: 20140313092127) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -214,10 +214,10 @@ ActiveRecord::Schema.define(version: 20140305193308) do t.string "issues_tracker_id" t.boolean "snippets_enabled", default: true, null: false t.datetime "last_activity_at" - t.boolean "imported", default: false, null: false t.string "import_url" t.integer "visibility_level", default: 0, null: false t.boolean "archived", default: false, null: false + t.string "import_status" end add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree |