gitlab-org--gitlab-foss/db/migrate/20170924094327_create_gcp_clusters.rb

46 lines
1.3 KiB
Ruby
Raw Normal View History

class CreateGcpClusters < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
create_table :gcp_clusters do |t|
2017-10-05 11:09:00 -04:00
# 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 }
2017-10-05 11:09:00 -04:00
t.integer :status
t.integer :gcp_cluster_size, null: false
2017-09-25 13:11:26 -04:00
2017-10-05 11:09:00 -04:00
# Timestamps
t.datetime_with_timezone :created_at, null: false
t.datetime_with_timezone :updated_at, null: false
# Enable/disable
t.boolean :enabled, default: true
2017-10-05 11:09:00 -04:00
# General
t.text :status_reason
2017-09-25 13:11:26 -04:00
# k8s integration specific
t.string :project_namespace
# Cluster details
t.string :endpoint
2017-09-25 13:11:26 -04:00
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
2017-09-25 13:11:26 -04:00
# 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