Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-06-02 00:39:24 +0300
committerMatija Čupić <matteeyah@gmail.com>2018-06-02 00:39:24 +0300
commit5e9687a198f205131d8e65c747f6b4ac2ae092f1 (patch)
tree586553d4fe7aa12291f37d9dfdcb149efc77e16e
parent2de002b3db1bc199755f8be212fa8804fcb80905 (diff)
Add deploy_strategy to ProjectAutoDevops
-rw-r--r--app/models/project_auto_devops.rb5
-rw-r--r--db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb15
-rw-r--r--db/schema.rb3
-rw-r--r--spec/models/project_auto_devops_spec.rb2
4 files changed, 24 insertions, 1 deletions
diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb
index ed6c1eddbc1..8464b1d9157 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 00000000000..d5ea25f02d4
--- /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 97247387bc7..fc0a6347c6e 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 7545c0797e9..1bfc6befb4b 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) }