mirror of
https://github.com/discourse/discourse.git
synced 2024-12-03 03:03:39 +08:00
a6e9f4f44b
``` change_column :topic_views, :ip_address, :inet, null: true ``` translates to ``` "ALTER TABLE \"topic_views\" ALTER COLUMN \"ip_address\" TYPE inet" ``` which locks the whole table while the migration is taking place.
17 lines
368 B
Ruby
17 lines
368 B
Ruby
class ChangeIndexesTopicViewItem < ActiveRecord::Migration[5.1]
|
|
def up
|
|
remove_index :topic_views,
|
|
column: [:ip_address, :topic_id],
|
|
name: :ip_address_topic_id_topic_views,
|
|
unique: true
|
|
|
|
remove_index :topic_views,
|
|
column: [:user_id, :topic_id],
|
|
name: :user_id_topic_id_topic_views,
|
|
unique: true
|
|
end
|
|
|
|
def down
|
|
end
|
|
end
|