summaryrefslogtreecommitdiff
path: root/db/migrate/20170329095907_create_ci_trigger_schedules.rb
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-29 19:07:25 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 23:46:58 +0900
commite32c1a5c92a80c350bbf3b70552be5cf29501fe7 (patch)
treed7f22f4e3c3c6d5ea6eb013567862bece1443b63 /db/migrate/20170329095907_create_ci_trigger_schedules.rb
parent4c2435f58e8b46c25af64b85345eb49dc5341f5a (diff)
downloadgitlab-ce-e32c1a5c92a80c350bbf3b70552be5cf29501fe7.tar.gz
Add ci_trigger_schedules table
Diffstat (limited to 'db/migrate/20170329095907_create_ci_trigger_schedules.rb')
-rw-r--r--db/migrate/20170329095907_create_ci_trigger_schedules.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/db/migrate/20170329095907_create_ci_trigger_schedules.rb b/db/migrate/20170329095907_create_ci_trigger_schedules.rb
new file mode 100644
index 00000000000..42f9497cac7
--- /dev/null
+++ b/db/migrate/20170329095907_create_ci_trigger_schedules.rb
@@ -0,0 +1,42 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class CreateCiTriggerSchedules < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ # When a migration requires downtime you **must** uncomment the following
+ # constant and define a short and easy to understand explanation as to why the
+ # migration requires downtime.
+ # DOWNTIME_REASON = ''
+
+ # When using the methods "add_concurrent_index" or "add_column_with_default"
+ # you must disable the use of transactions as these methods can not run in an
+ # existing transaction. When using "add_concurrent_index" make sure that this
+ # method is the _only_ method called in the migration, any other changes
+ # should go in a separate migration. This ensures that upon failure _only_ the
+ # index creation fails and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ # disable_ddl_transaction!
+
+ def change
+ create_table :ci_trigger_schedules do |t|
+ t.integer "project_id"
+ t.integer "trigger_id", null: false
+ t.datetime "deleted_at"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "cron"
+ t.string "cron_time_zone"
+ 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_foreign_key :ci_trigger_schedules, :ci_triggers, column: :trigger_id, on_delete: :cascade
+ end
+end