diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-04-06 16:32:56 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-04-06 16:32:56 +0300 |
commit | 057c0d7a5c062f3030bcc46614ef2442009002de (patch) | |
tree | e4e9f8b092500950e914955f8d257c3b443a77dd /db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb | |
parent | 98a4aca6b5ce503543b0e325212265a365e64d75 (diff) |
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/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb')
-rw-r--r-- | db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb | 22 |
1 files changed, 22 insertions, 0 deletions
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 |