From 3b35d1f8c153fb31af66049ba5461f9b39c66397 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 6 Mar 2017 18:24:55 +0100 Subject: Migrate legacy actions in post deployment migration --- .../20170306090835_migrate_legacy_manual_actions.rb | 19 ------------------- .../20170306170512_migrate_legacy_manual_actions.rb | 19 +++++++++++++++++++ db/schema.rb | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 db/migrate/20170306090835_migrate_legacy_manual_actions.rb create mode 100644 db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb diff --git a/db/migrate/20170306090835_migrate_legacy_manual_actions.rb b/db/migrate/20170306090835_migrate_legacy_manual_actions.rb deleted file mode 100644 index 9020e0d054c..00000000000 --- a/db/migrate/20170306090835_migrate_legacy_manual_actions.rb +++ /dev/null @@ -1,19 +0,0 @@ -class MigrateLegacyManualActions < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - execute <<-EOS - UPDATE ci_builds SET status = 'manual', allow_failure = true - WHERE ci_builds.when = 'manual' AND ci_builds.status = 'skipped'; - EOS - end - - def down - execute <<-EOS - UPDATE ci_builds SET status = 'skipped', allow_failure = false - WHERE ci_builds.when = 'manual' AND ci_builds.status = 'manual'; - EOS - end -end diff --git a/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb b/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb new file mode 100644 index 00000000000..9020e0d054c --- /dev/null +++ b/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb @@ -0,0 +1,19 @@ +class MigrateLegacyManualActions < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + execute <<-EOS + UPDATE ci_builds SET status = 'manual', allow_failure = true + WHERE ci_builds.when = 'manual' AND ci_builds.status = 'skipped'; + EOS + end + + def down + execute <<-EOS + UPDATE ci_builds SET status = 'skipped', allow_failure = false + WHERE ci_builds.when = 'manual' AND ci_builds.status = 'manual'; + EOS + end +end diff --git a/db/schema.rb b/db/schema.rb index d1d3f9d6dd5..68e755979ff 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170306090835) do +ActiveRecord::Schema.define(version: 20170306170512) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1