Browse Source

Merge pull request #197 from Lackoftactics/index_concurrently

Make current migration safe using index concurrently
master
Dmitrii Golub 4 years ago committed by GitHub
parent
commit
7e0faa6e1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      lib/generators/active_record/templates/migration.rb

4
lib/generators/active_record/templates/migration.rb

@ -1,4 +1,6 @@
class TwoFactorAuthenticationAddTo<%= table_name.camelize %> < ActiveRecord::Migration
disable_ddl_transaction!
def change
add_column :<%= table_name %>, :second_factor_attempts_count, :integer, default: 0
add_column :<%= table_name %>, :encrypted_otp_secret_key, :string
@ -8,6 +10,6 @@ class TwoFactorAuthenticationAddTo<%= table_name.camelize %> < ActiveRecord::Mig
add_column :<%= table_name %>, :direct_otp_sent_at, :datetime
add_column :<%= table_name %>, :totp_timestamp, :timestamp
add_index :<%= table_name %>, :encrypted_otp_secret_key, unique: true
add_index :<%= table_name %>, :encrypted_otp_secret_key, unique: true, algorithm: :concurrently
end
end

Loading…
Cancel
Save