From 2178cd44c59effb67cef0743064a75f5073c9f45 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 5 Oct 2017 17:09:00 +0200 Subject: Optimise gcp_clusters table schema --- db/migrate/20170924094327_create_gcp_clusters.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'db/migrate/20170924094327_create_gcp_clusters.rb') diff --git a/db/migrate/20170924094327_create_gcp_clusters.rb b/db/migrate/20170924094327_create_gcp_clusters.rb index 42171be7fc4..657dddcbbc4 100644 --- a/db/migrate/20170924094327_create_gcp_clusters.rb +++ b/db/migrate/20170924094327_create_gcp_clusters.rb @@ -3,13 +3,21 @@ class CreateGcpClusters < ActiveRecord::Migration def change 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 - # 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.integer :status + + # General t.text :status_reason # k8s integration specific @@ -28,14 +36,10 @@ class CreateGcpClusters < ActiveRecord::Migration t.string :gcp_project_id, null: false t.string :gcp_cluster_zone, null: false t.string :gcp_cluster_name, null: false - t.integer :gcp_cluster_size, null: false t.string :gcp_machine_type t.string :gcp_operation_id t.text :encrypted_gcp_token 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 -- cgit v1.2.3