Commit 6473f697 authored by Mayra Cabrera's avatar Mayra Cabrera Committed by Kamil Trzciński

Add new field to Clusters table

Adds boolean field 'managed' to clusters table. This new column will be
used to distinguish those clusters that are automatically managed by
gitlab.

Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/56557
parent c44b9e9e
# frozen_string_literal: true
class AddManagedToCluster < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
DOWNTIME = false
def up
add_column_with_default(:clusters, :managed, :boolean, default: true)
end
def down
remove_column(:clusters, :managed)
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190322132835) do ActiveRecord::Schema.define(version: 20190325165127) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -670,6 +670,7 @@ ActiveRecord::Schema.define(version: 20190322132835) do ...@@ -670,6 +670,7 @@ ActiveRecord::Schema.define(version: 20190322132835) do
t.string "environment_scope", default: "*", null: false t.string "environment_scope", default: "*", null: false
t.integer "cluster_type", limit: 2, default: 3, null: false t.integer "cluster_type", limit: 2, default: 3, null: false
t.string "domain" t.string "domain"
t.boolean "managed", default: true, null: false
t.index ["enabled"], name: "index_clusters_on_enabled", using: :btree t.index ["enabled"], name: "index_clusters_on_enabled", using: :btree
t.index ["user_id"], name: "index_clusters_on_user_id", using: :btree t.index ["user_id"], name: "index_clusters_on_user_id", using: :btree
end end
......
...@@ -3,6 +3,7 @@ FactoryBot.define do ...@@ -3,6 +3,7 @@ FactoryBot.define do
user user
name 'test-cluster' name 'test-cluster'
cluster_type :project_type cluster_type :project_type
managed true
trait :instance do trait :instance do
cluster_type { Clusters::Cluster.cluster_types[:instance_type] } cluster_type { Clusters::Cluster.cluster_types[:instance_type] }
...@@ -63,5 +64,9 @@ FactoryBot.define do ...@@ -63,5 +64,9 @@ FactoryBot.define do
trait :with_domain do trait :with_domain do
domain 'example.com' domain 'example.com'
end end
trait :user_managed do
managed false
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment