diff options
author | Matt Kasa <mkasa@gitlab.com> | 2019-08-15 21:39:03 +0300 |
---|---|---|
committer | Matt Kasa <mkasa@gitlab.com> | 2019-08-15 21:39:03 +0300 |
commit | e7c684204d20b7872f44204cb465e841dfb1660b (patch) | |
tree | b2d9ba92c3e1dc93f1f89eec6d8644d395b04b24 | |
parent | e2361565ceb1754bd63c2d98a5c1cfe134e93160 (diff) |
Add cloud_run column to clusters table for Cloud Run on GKE
-rw-r--r-- | app/models/clusters/cluster.rb | 1 | ||||
-rw-r--r-- | db/migrate/20190807234536_add_cloud_run_to_cluster.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 97d39491b73..e0a5e06ec26 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -98,6 +98,7 @@ module Clusters scope :gcp_provided, -> { where(provider_type: ::Clusters::Cluster.provider_types[:gcp]) } scope :gcp_installed, -> { gcp_provided.includes(:provider_gcp).where(cluster_providers_gcp: { status: ::Clusters::Providers::Gcp.state_machines[:status].states[:created].value }) } scope :managed, -> { where(managed: true) } + scope :cloud_run, -> { where(cloud_run: true) } scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) } diff --git a/db/migrate/20190807234536_add_cloud_run_to_cluster.rb b/db/migrate/20190807234536_add_cloud_run_to_cluster.rb new file mode 100644 index 00000000000..9fe5ffdbfbb --- /dev/null +++ b/db/migrate/20190807234536_add_cloud_run_to_cluster.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddCloudRunToCluster < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:clusters, :cloud_run, :boolean, default: false) + end + + def down + remove_column(:clusters, :cloud_run) + end +end diff --git a/db/schema.rb b/db/schema.rb index 591758af0e4..221619fe305 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -883,6 +883,7 @@ ActiveRecord::Schema.define(version: 2019_08_06_071559) do t.string "domain" t.boolean "managed", default: true, null: false t.boolean "namespace_per_environment", default: false, null: false + t.boolean "cloud_run", default: false, null: false t.index ["enabled"], name: "index_clusters_on_enabled" t.index ["user_id"], name: "index_clusters_on_user_id" end |