debian-mirror-gitlab/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb

27 lines
950 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2019-02-15 15:39:39 +05:30
class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2]
2018-12-13 13:39:08 +05:30
DOWNTIME = false
INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace'
def change
2019-12-04 20:38:33 +05:30
# rubocop:disable Migration/AddLimitToStringColumns
2018-12-13 13:39:08 +05:30
create_table :clusters_kubernetes_namespaces, id: :bigserial do |t|
t.references :cluster, null: false, index: true, foreign_key: { on_delete: :cascade }
t.references :project, index: true, foreign_key: { on_delete: :nullify }
t.references :cluster_project, index: true, foreign_key: { on_delete: :nullify }
t.timestamps_with_timezone null: false
t.string :encrypted_service_account_token_iv
t.string :namespace, null: false
t.string :service_account_name
t.text :encrypted_service_account_token
t.index [:cluster_id, :namespace], name: INDEX_NAME, unique: true
end
2019-12-04 20:38:33 +05:30
# rubocop:enable Migration/AddLimitToStringColumns
2018-12-13 13:39:08 +05:30
end
end