diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-04-06 21:32:56 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-04-06 21:32:56 +0800 |
commit | 057c0d7a5c062f3030bcc46614ef2442009002de (patch) | |
tree | e4e9f8b092500950e914955f8d257c3b443a77dd /db | |
parent | 98a4aca6b5ce503543b0e325212265a365e64d75 (diff) | |
download | gitlab-ce-057c0d7a5c062f3030bcc46614ef2442009002de.tar.gz |
Also track auto-cancelling in jobs, detail:
Not only tracking auto-cancelling in pipelines,
we'll also track this in jobs because pipelines
could be retried and the information would get lost
when this happened. Also erase auto-cancelling
relation for pipelines when they're retried.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb | 9 | ||||
-rw-r--r-- | db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb | 22 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 33 insertions, 0 deletions
diff --git a/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb b/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb new file mode 100644 index 00000000000..c1d803b4308 --- /dev/null +++ b/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb @@ -0,0 +1,9 @@ +class AddAutoCanceledByIdToCiBuilds < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_builds, :auto_canceled_by_id, :integer + end +end diff --git a/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb b/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb new file mode 100644 index 00000000000..3004683933b --- /dev/null +++ b/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb @@ -0,0 +1,22 @@ +class AddAutoCanceledByIdForeignKeyToCiBuilds < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + on_delete = + if Gitlab::Database.mysql? + :nullify + else + 'SET NULL' + end + + add_concurrent_foreign_key :ci_builds, :ci_pipelines, column: :auto_canceled_by_id, on_delete: on_delete + end + + def down + remove_foreign_key :ci_builds, column: :auto_canceled_by_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 59dbe9fd69a..afc67dba702 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -223,6 +223,7 @@ ActiveRecord::Schema.define(version: 20170405080720) do t.string "token" t.integer "lock_version" t.string "coverage_regex" + t.integer "auto_canceled_by_id" end add_index "ci_builds", ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree @@ -1300,6 +1301,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_builds", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_a2141b1522", on_delete: :nullify add_foreign_key "ci_pipelines", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_262d4c2d19", on_delete: :nullify add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade |