diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-04-06 18:55:34 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-04-06 18:55:34 +0000 |
commit | 1815d44a7ffd86f8eefd42ae0eac59a6ade66e7f (patch) | |
tree | 6b61d8de4b0d6ff912b5ed6343922758447330e9 /db | |
parent | bef1aca8837f2306ecbd8ff70deb2204bf1da539 (diff) | |
parent | 9441c01484e668892d06f387fc0f85fe2d4ff4b4 (diff) | |
download | gitlab-ce-1815d44a7ffd86f8eefd42ae0eac59a6ade66e7f.tar.gz |
Merge branch '2989-run-cicd-pipelines-on-a-schedule-idea1-basic-backend-implementation' into 'master'
Resolve "Run CI/CD pipelines on a schedule" - "Basic backend implementation"
See merge request !10133
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170329095325_add_ref_to_triggers.rb | 9 | ||||
-rw-r--r-- | db/migrate/20170329095907_create_ci_trigger_schedules.rb | 21 | ||||
-rw-r--r-- | db/migrate/20170404163427_add_trigger_id_foreign_key.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 16 |
4 files changed, 61 insertions, 0 deletions
diff --git a/db/migrate/20170329095325_add_ref_to_triggers.rb b/db/migrate/20170329095325_add_ref_to_triggers.rb new file mode 100644 index 00000000000..4aa52dd8f8f --- /dev/null +++ b/db/migrate/20170329095325_add_ref_to_triggers.rb @@ -0,0 +1,9 @@ +class AddRefToTriggers < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_triggers, :ref, :string + end +end 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..cfcfa27ebb5 --- /dev/null +++ b/db/migrate/20170329095907_create_ci_trigger_schedules.rb @@ -0,0 +1,21 @@ +class CreateCiTriggerSchedules < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + 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_timezone" + t.datetime "next_run_at" + end + + 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 d8e116b7903..a7a8f5bd38f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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_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 + create_table "ci_triggers", force: :cascade do |t| t.string "token" t.datetime "deleted_at" @@ -308,6 +322,7 @@ ActiveRecord::Schema.define(version: 20170405080720) do t.integer "project_id" t.integer "owner_id" t.string "description" + t.string "ref" end add_index "ci_triggers", ["project_id"], name: "index_ci_triggers_on_project_id", using: :btree @@ -1313,6 +1328,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", name: "fk_90a406cc94", on_delete: :cascade add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade add_foreign_key "container_repositories", "projects" add_foreign_key "issue_metrics", "issues", on_delete: :cascade |