diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20181031190559_drop_gcp_clusters_table.rb | 53 | ||||
-rw-r--r-- | db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 32 |
3 files changed, 50 insertions, 53 deletions
diff --git a/db/migrate/20181031190559_drop_gcp_clusters_table.rb b/db/migrate/20181031190559_drop_gcp_clusters_table.rb deleted file mode 100644 index 808d474b4fc..00000000000 --- a/db/migrate/20181031190559_drop_gcp_clusters_table.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -class DropGcpClustersTable < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - drop_table :gcp_clusters - end - - def down - create_table :gcp_clusters do |t| - # Order columns by best align scheme - t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } - t.references :user, foreign_key: { on_delete: :nullify } - t.references :service, foreign_key: { on_delete: :nullify } - t.integer :status - t.integer :gcp_cluster_size, null: false - - # Timestamps - t.datetime_with_timezone :created_at, null: false - t.datetime_with_timezone :updated_at, null: false - - # Enable/disable - t.boolean :enabled, default: true - - # General - t.text :status_reason - - # k8s integration specific - t.string :project_namespace - - # Cluster details - t.string :endpoint - t.text :ca_cert - t.text :encrypted_kubernetes_token - t.string :encrypted_kubernetes_token_iv - t.string :username - t.text :encrypted_password - t.string :encrypted_password_iv - - # GKE - t.string :gcp_project_id, null: false - t.string :gcp_cluster_zone, null: false - t.string :gcp_cluster_name, null: false - t.string :gcp_machine_type - t.string :gcp_operation_id - t.text :encrypted_gcp_token - t.string :encrypted_gcp_token_iv - end - end -end diff --git a/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb b/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb new file mode 100644 index 00000000000..f80a2aa6eac --- /dev/null +++ b/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class EnqueuePopulateClusterKubernetesNamespace < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'PopulateClusterKubernetesNamespaceTable'.freeze + + disable_ddl_transaction! + + def up + BackgroundMigrationWorker.perform_async(MIGRATION) + end + + def down + Clusters::KubernetesNamespace.delete_all + end +end diff --git a/db/schema.rb b/db/schema.rb index 31f8403e1f2..fe30c5375f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -924,6 +924,35 @@ ActiveRecord::Schema.define(version: 20181101144347) do add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree + create_table "gcp_clusters", force: :cascade do |t| + t.integer "project_id", null: false + t.integer "user_id" + t.integer "service_id" + t.integer "status" + t.integer "gcp_cluster_size", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.boolean "enabled", default: true + t.text "status_reason" + t.string "project_namespace" + t.string "endpoint" + t.text "ca_cert" + t.text "encrypted_kubernetes_token" + t.string "encrypted_kubernetes_token_iv" + t.string "username" + t.text "encrypted_password" + t.string "encrypted_password_iv" + t.string "gcp_project_id", null: false + t.string "gcp_cluster_zone", null: false + t.string "gcp_cluster_name", null: false + t.string "gcp_machine_type" + t.string "gcp_operation_id" + t.text "encrypted_gcp_token" + t.string "encrypted_gcp_token_iv" + end + + add_index "gcp_clusters", ["project_id"], name: "index_gcp_clusters_on_project_id", unique: true, using: :btree + create_table "gpg_key_subkeys", force: :cascade do |t| t.integer "gpg_key_id", null: false t.binary "keyid" @@ -2407,6 +2436,9 @@ ActiveRecord::Schema.define(version: 20181101144347) do add_foreign_key "fork_network_members", "projects", on_delete: :cascade add_foreign_key "fork_networks", "projects", column: "root_project_id", name: "fk_e7b436b2b5", on_delete: :nullify add_foreign_key "forked_project_links", "projects", column: "forked_to_project_id", name: "fk_434510edb0", on_delete: :cascade + add_foreign_key "gcp_clusters", "projects", on_delete: :cascade + add_foreign_key "gcp_clusters", "services", on_delete: :nullify + add_foreign_key "gcp_clusters", "users", on_delete: :nullify add_foreign_key "gpg_key_subkeys", "gpg_keys", on_delete: :cascade add_foreign_key "gpg_keys", "users", on_delete: :cascade add_foreign_key "gpg_signatures", "gpg_key_subkeys", on_delete: :nullify |