Commit 2178cd44 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Optimise gcp_clusters table schema

parent 58bf29da
...@@ -3,13 +3,21 @@ class CreateGcpClusters < ActiveRecord::Migration ...@@ -3,13 +3,21 @@ class CreateGcpClusters < ActiveRecord::Migration
def change def change
create_table :gcp_clusters do |t| 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 :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
t.references :user, foreign_key: { on_delete: :nullify } t.references :user, foreign_key: { on_delete: :nullify }
t.references :service, foreign_key: { on_delete: :nullify } t.references :service, foreign_key: { on_delete: :nullify }
t.integer :status
t.integer :gcp_cluster_size, null: false
# General # Timestamps
t.datetime_with_timezone :created_at, null: false
t.datetime_with_timezone :updated_at, null: false
# Enable/disable
t.boolean :enabled, default: true t.boolean :enabled, default: true
t.integer :status
# General
t.text :status_reason t.text :status_reason
# k8s integration specific # k8s integration specific
...@@ -28,14 +36,10 @@ class CreateGcpClusters < ActiveRecord::Migration ...@@ -28,14 +36,10 @@ class CreateGcpClusters < ActiveRecord::Migration
t.string :gcp_project_id, null: false t.string :gcp_project_id, null: false
t.string :gcp_cluster_zone, null: false t.string :gcp_cluster_zone, null: false
t.string :gcp_cluster_name, null: false t.string :gcp_cluster_name, null: false
t.integer :gcp_cluster_size, null: false
t.string :gcp_machine_type t.string :gcp_machine_type
t.string :gcp_operation_id t.string :gcp_operation_id
t.text :encrypted_gcp_token t.text :encrypted_gcp_token
t.string :encrypted_gcp_token_iv t.string :encrypted_gcp_token_iv
t.datetime_with_timezone :created_at, null: false
t.datetime_with_timezone :updated_at, null: false
end end
end end
end end
...@@ -583,8 +583,11 @@ ActiveRecord::Schema.define(version: 20171004121444) do ...@@ -583,8 +583,11 @@ ActiveRecord::Schema.define(version: 20171004121444) do
t.integer "project_id", null: false t.integer "project_id", null: false
t.integer "user_id" t.integer "user_id"
t.integer "service_id" t.integer "service_id"
t.boolean "enabled", default: true
t.integer "status" 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.text "status_reason"
t.string "project_namespace" t.string "project_namespace"
t.string "endpoint" t.string "endpoint"
...@@ -597,13 +600,10 @@ ActiveRecord::Schema.define(version: 20171004121444) do ...@@ -597,13 +600,10 @@ ActiveRecord::Schema.define(version: 20171004121444) do
t.string "gcp_project_id", null: false t.string "gcp_project_id", null: false
t.string "gcp_cluster_zone", null: false t.string "gcp_cluster_zone", null: false
t.string "gcp_cluster_name", null: false t.string "gcp_cluster_name", null: false
t.integer "gcp_cluster_size", null: false
t.string "gcp_machine_type" t.string "gcp_machine_type"
t.string "gcp_operation_id" t.string "gcp_operation_id"
t.text "encrypted_gcp_token" t.text "encrypted_gcp_token"
t.string "encrypted_gcp_token_iv" t.string "encrypted_gcp_token_iv"
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
end end
add_index "gcp_clusters", ["project_id"], name: "index_gcp_clusters_on_project_id", unique: true, using: :btree add_index "gcp_clusters", ["project_id"], name: "index_gcp_clusters_on_project_id", unique: true, using: :btree
......
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