summaryrefslogtreecommitdiff
path: root/db/migrate/20200416120128_add_columns_to_terraform_state.rb
blob: 65d25d842e5fb5da8a74108c8f2ee82f894545da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class AddColumnsToTerraformState < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  # rubocop:disable Migration/PreventStrings
  def change
    add_column :terraform_states, :lock_xid, :string, limit: 255
    add_column :terraform_states, :locked_at, :datetime_with_timezone
    add_column :terraform_states, :locked_by_user_id, :bigint
    add_column :terraform_states, :uuid, :string, limit: 32, null: false # rubocop:disable Rails/NotNullColumn (table not used yet)
    add_column :terraform_states, :name, :string, limit: 255
    add_index :terraform_states, :locked_by_user_id # rubocop:disable Migration/AddIndex (table not used yet)
    add_index :terraform_states, :uuid, unique: true # rubocop:disable Migration/AddIndex (table not used yet)
    add_index :terraform_states, [:project_id, :name], unique: true # rubocop:disable Migration/AddIndex (table not used yet)
    remove_index :terraform_states, :project_id # rubocop:disable Migration/RemoveIndex (table not used yet)
  end
  # rubocop:enable Migration/PreventStrings
end