提交 6473f697 编写于 作者: M Mayra Cabrera 提交者: 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
上级 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 @@
#
# 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
enable_extension "plpgsql"
......@@ -670,6 +670,7 @@ ActiveRecord::Schema.define(version: 20190322132835) do
t.string "environment_scope", default: "*", null: false
t.integer "cluster_type", limit: 2, default: 3, null: false
t.string "domain"
t.boolean "managed", default: true, null: false
t.index ["enabled"], name: "index_clusters_on_enabled", using: :btree
t.index ["user_id"], name: "index_clusters_on_user_id", using: :btree
end
......
......@@ -3,6 +3,7 @@ FactoryBot.define do
user
name 'test-cluster'
cluster_type :project_type
managed true
trait :instance do
cluster_type { Clusters::Cluster.cluster_types[:instance_type] }
......@@ -63,5 +64,9 @@ FactoryBot.define do
trait :with_domain do
domain 'example.com'
end
trait :user_managed do
managed false
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册