2020-02-10 07:08:59 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CreateDeploymentClusters < ActiveRecord::Migration[6.0]
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
# rubocop:disable Migration/PreventStrings
|
2020-02-10 07:08:59 -05:00
|
|
|
def change
|
|
|
|
create_table :deployment_clusters, id: false, force: :cascade do |t|
|
|
|
|
t.references :deployment, foreign_key: { on_delete: :cascade }, primary_key: true, type: :integer, index: false, default: nil
|
|
|
|
t.references :cluster, foreign_key: { on_delete: :cascade }, type: :integer, index: false, null: false
|
|
|
|
t.string :kubernetes_namespace, limit: 255
|
|
|
|
|
|
|
|
t.index [:cluster_id, :kubernetes_namespace], name: 'idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace'
|
|
|
|
t.index [:cluster_id, :deployment_id], unique: true
|
|
|
|
end
|
|
|
|
end
|
2020-04-21 11:21:10 -04:00
|
|
|
# rubocop:enable Migration/PreventStrings
|
2020-02-10 07:08:59 -05:00
|
|
|
end
|