summaryrefslogtreecommitdiff
path: root/db/migrate/20170924094327_create_ci_clusters.rb
blob: 798c8e03b3781af724b99155ccc395de2f8ddf52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class CreateCiClusters < ActiveRecord::Migration
  DOWNTIME = false

  def up
    create_table :ci_clusters do |t|
      t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
      t.references :user, null: false, foreign_key: true
      t.references :service, foreign_key: true

      # General
      t.boolean :enabled, default: true
      t.integer :status
      t.string :status_reason

      # k8s integration specific
      t.string :project_namespace

      # Cluster details
      t.string :endpoint
      t.text :ca_cert
      t.string :encrypted_kubernetes_token
      t.string :encrypted_kubernetes_token_salt
      t.string :encrypted_kubernetes_token_iv
      t.string :username
      t.string :encrypted_password
      t.string :encrypted_password_salt
      t.string :encrypted_password_iv

      # GKE
      t.string :gcp_project_id
      t.string :cluster_zone
      t.string :cluster_name
      t.string :cluster_size
      t.string :machine_type
      t.string :gcp_operation_id
      t.string :encrypted_gcp_token
      t.string :encrypted_gcp_token_salt
      t.string :encrypted_gcp_token_iv

      t.datetime_with_timezone :created_at, null: false
      t.datetime_with_timezone :updated_at, null: false
    end
  end

  def down
    drop_table :ci_clusters
  end
end