summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-06 10:50:35 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-06 10:50:35 +0100
commit3788f5face7660c43374d85a4fdbeca04e7b8d68 (patch)
treebc59f481b28eaf26811d0db70cee9207d0b800d2 /db
parente4554925011eef2be49fd10bd10cde2139342780 (diff)
downloadgitlab-ce-3788f5face7660c43374d85a4fdbeca04e7b8d68.tar.gz
Add migration for manual actions with skipped status
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170306090835_migrate_legacy_manual_actions.rb19
-rw-r--r--db/schema.rb2
2 files changed, 20 insertions, 1 deletions
diff --git a/db/migrate/20170306090835_migrate_legacy_manual_actions.rb b/db/migrate/20170306090835_migrate_legacy_manual_actions.rb
new file mode 100644
index 00000000000..9020e0d054c
--- /dev/null
+++ b/db/migrate/20170306090835_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 cd5aa339269..d034f28c3ca 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: 20170217151947) do
+ActiveRecord::Schema.define(version: 20170306090835) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"