mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-01 07:11:26 +08:00
This is a follow up to 6820622467.
This commit addresses migrations that uses `remove_index` with the
`if_exists: true` option to drop an existing index before creating an
index using the `concurrently` option.
This commit also reruns two migration which may have caused indexes to
be left in an `invalid` state.
### Reviewers Note
Plugin tests are failing due to
https://github.com/discourse/discourse-translator/pull/251
19 lines
473 B
Ruby
19 lines
473 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddIndexToUsersIpAddress < ActiveRecord::Migration[7.1]
|
|
disable_ddl_transaction!
|
|
|
|
def up
|
|
remove_index :users,
|
|
:ip_address,
|
|
algorithm: :concurrently,
|
|
name: "idx_users_ip_address",
|
|
if_exists: true
|
|
|
|
add_index :users, :ip_address, algorithm: :concurrently, name: "idx_users_ip_address"
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|