Add ci_trigger_schedules table

This commit is contained in:
Shinya Maeda 2017-03-29 19:07:25 +09:00
parent 4c2435f58e
commit e32c1a5c92
2 changed files with 57 additions and 0 deletions

View file

@ -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

View file

@ -300,6 +300,20 @@ ActiveRecord::Schema.define(version: 20170405080720) do
add_index "ci_trigger_requests", ["commit_id"], name: "index_ci_trigger_requests_on_commit_id", using: :btree
create_table "ci_trigger_schedules", force: :cascade 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
create_table "ci_triggers", force: :cascade do |t|
t.string "token"
t.datetime "deleted_at"
@ -1299,6 +1313,7 @@ ActiveRecord::Schema.define(version: 20170405080720) do
add_foreign_key "boards", "projects"
add_foreign_key "chat_teams", "namespaces", on_delete: :cascade
add_foreign_key "ci_trigger_schedules", "ci_triggers", column: "trigger_id", on_delete: :cascade
add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade
add_foreign_key "issue_metrics", "issues", on_delete: :cascade
add_foreign_key "label_priorities", "labels", on_delete: :cascade