summaryrefslogtreecommitdiff
path: root/db/migrate/20170924094327_create_ci_clusters.rb
blob: 86e75edf203f90a3680d6ec8db946c22a0d624f2 (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
class CreateCiClusters < ActiveRecord::Migration
  DOWNTIME = false

  def change
    create_table :ci_clusters do |t|
      t.integer :project_id
      t.integer :owner_id
      t.datetime_with_timezone :created_at, null: false
      t.datetime_with_timezone :updated_at, null: false
      t.boolean :enabled, default: true
      t.string :end_point
      t.text :ca_cert # Base64?
      t.string :token
      t.string :username
      t.string :password
      t.string :project_namespace
      t.integer :creation_type # manual or on_gke
    end

    # TODO: fk, index, encypt

    add_foreign_key :ci_clusters, :projects
    add_foreign_key :ci_clusters, :users, column: :owner_id
  end

  def down
    drop_table :ci_clusters
  end
end