diff options
-rw-r--r-- | changelogs/unreleased/drop-default-value-status-deployments.yml | 5 | ||||
-rw-r--r-- | db/migrate/20181112103239_drop_default_value_on_status_deployments.rb | 14 | ||||
-rw-r--r-- | db/schema.rb | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/changelogs/unreleased/drop-default-value-status-deployments.yml b/changelogs/unreleased/drop-default-value-status-deployments.yml new file mode 100644 index 00000000000..fdb826a0507 --- /dev/null +++ b/changelogs/unreleased/drop-default-value-status-deployments.yml @@ -0,0 +1,5 @@ +--- +title: Drop default value on status column in deployments table +merge_request: 22971 +author: +type: other diff --git a/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb new file mode 100644 index 00000000000..a480c15e66b --- /dev/null +++ b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class DropDefaultValueOnStatusDeployments < ActiveRecord::Migration + DOWNTIME = false + DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.state_machine.states['success'].value + + def up + change_column_default :deployments, :status, nil + end + + def down + change_column_default :deployments, :status, DEPLOYMENT_STATUS_SUCCESS + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e02f43f702..cc47368c530 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20181107054254) do +ActiveRecord::Schema.define(version: 20181112103239) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -807,7 +807,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime "created_at" t.datetime "updated_at" t.string "on_stop" - t.integer "status", limit: 2, default: 2, null: false + t.integer "status", limit: 2, null: false t.datetime_with_timezone "finished_at" t.index ["created_at"], name: "index_deployments_on_created_at", using: :btree t.index ["deployable_type", "deployable_id"], name: "index_deployments_on_deployable_type_and_deployable_id", using: :btree |