diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-04-05 01:54:45 +0900 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-04-06 23:46:59 +0900 |
commit | 4688eb47c6fe135fb9baad5a5d56b1dfa685cc7f (patch) | |
tree | 73ed8531a88ff7088ea419aa4518be02cd82f3ae /db | |
parent | 1dbc888e3306f30ca0882aece86ccd1a817e0ab8 (diff) | |
download | gitlab-ce-4688eb47c6fe135fb9baad5a5d56b1dfa685cc7f.tar.gz |
Rename cron_time_zone to cron_timezone. Separate add_concurrent_foreign_key.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170329095907_create_ci_trigger_schedules.rb | 16 | ||||
-rw-r--r-- | db/migrate/20170404163427_add_trigger_id_foreign_key.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 20 insertions, 13 deletions
diff --git a/db/migrate/20170329095907_create_ci_trigger_schedules.rb b/db/migrate/20170329095907_create_ci_trigger_schedules.rb index 3dcd05175c0..cfcfa27ebb5 100644 --- a/db/migrate/20170329095907_create_ci_trigger_schedules.rb +++ b/db/migrate/20170329095907_create_ci_trigger_schedules.rb @@ -3,9 +3,7 @@ class CreateCiTriggerSchedules < ActiveRecord::Migration DOWNTIME = false - disable_ddl_transaction! - - def up + def change create_table :ci_trigger_schedules do |t| t.integer "project_id" t.integer "trigger_id", null: false @@ -13,17 +11,11 @@ class CreateCiTriggerSchedules < ActiveRecord::Migration t.datetime "created_at" t.datetime "updated_at" t.string "cron" - t.string "cron_time_zone" + t.string "cron_timezone" t.datetime "next_run_at" end - add_index :ci_trigger_schedules, ["next_run_at"], name: "index_ci_trigger_schedules_on_next_run_at", using: :btree - add_index :ci_trigger_schedules, ["project_id"], name: "index_ci_trigger_schedules_on_project_id", using: :btree - add_concurrent_foreign_key :ci_trigger_schedules, :ci_triggers, column: :trigger_id, on_delete: :cascade - end - - def down - remove_foreign_key :ci_trigger_schedules, column: :trigger_id - drop_table :ci_trigger_schedules + add_index :ci_trigger_schedules, :next_run_at + add_index :ci_trigger_schedules, :project_id end end diff --git a/db/migrate/20170404163427_add_trigger_id_foreign_key.rb b/db/migrate/20170404163427_add_trigger_id_foreign_key.rb new file mode 100644 index 00000000000..6679a95ca11 --- /dev/null +++ b/db/migrate/20170404163427_add_trigger_id_foreign_key.rb @@ -0,0 +1,15 @@ +class AddTriggerIdForeignKey < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :ci_trigger_schedules, :ci_triggers, column: :trigger_id, on_delete: :cascade + end + + def down + remove_foreign_key :ci_trigger_schedules, column: :trigger_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 7d9f969c2e1..a564a4b6a12 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -307,7 +307,7 @@ ActiveRecord::Schema.define(version: 20170405080720) do t.datetime "created_at" t.datetime "updated_at" t.string "cron" - t.string "cron_time_zone" + t.string "cron_timezone" t.datetime "next_run_at" end |