diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb index ed6c1eddbc15305a97b31eac58b474829058f40e..8464b1d91579e480b298c144cd3651843d7a9f60 100644 --- a/app/models/project_auto_devops.rb +++ b/app/models/project_auto_devops.rb @@ -1,6 +1,11 @@ class ProjectAutoDevops < ActiveRecord::Base belongs_to :project + enum deploy_strategy: { + manual: 1, + continuous: 2 + } + scope :enabled, -> { where(enabled: true) } scope :disabled, -> { where(enabled: false) } diff --git a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb new file mode 100644 index 0000000000000000000000000000000000000000..d5ea25f02d43d819a1f4e2f7b9f9bf23fe12e9ec --- /dev/null +++ b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb @@ -0,0 +1,15 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddDeployStrategyToProjectAutoDevops < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + change_table :project_auto_devops do |t| + t.integer :deploy_strategy, null: false, default: 0 + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 97247387bc7a385468f603a080e16c0d77043b11..fc0a6347c6e5b9682fca49fce60e0237c4b7641d 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: 20180529093006) do +ActiveRecord::Schema.define(version: 20180601213245) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1490,6 +1490,7 @@ ActiveRecord::Schema.define(version: 20180529093006) do t.datetime_with_timezone "updated_at", null: false t.boolean "enabled" t.string "domain" + t.integer "deploy_strategy", default: 0, null: false end add_index "project_auto_devops", ["project_id"], name: "index_project_auto_devops_on_project_id", unique: true, using: :btree diff --git a/spec/models/project_auto_devops_spec.rb b/spec/models/project_auto_devops_spec.rb index 7545c0797e9a2188837f4d268bd8f93c92740e6d..1bfc6befb4b114a1eb86865ee550423148964221 100644 --- a/spec/models/project_auto_devops_spec.rb +++ b/spec/models/project_auto_devops_spec.rb @@ -5,6 +5,8 @@ describe ProjectAutoDevops do it { is_expected.to belong_to(:project) } + it { is_expected.to define_enum_for(:deploy_strategy) } + it { is_expected.to respond_to(:created_at) } it { is_expected.to respond_to(:updated_at) }