impress/db/migrate/20240511003019_add_unique_index_on_item_id_to_nc_mall_records.rb
Matchu 46d3325144 Load *all* NC Mall pages in nc_mall:sync
Ta da! Now I can run this and pull 481 records into our database, and
then turn around and run it again and have them all correctly say
"skipped"!
2024-05-10 17:39:40 -07:00

11 lines
395 B
Ruby

class AddUniqueIndexOnItemIdToNCMallRecords < ActiveRecord::Migration[7.1]
def change
# NOTE: We need to temporarily remove the foreign key, then add it back
# once the index is in.
remove_foreign_key :nc_mall_records, :items
remove_index :nc_mall_records, :item_id
add_index :nc_mall_records, :item_id, unique: true
add_foreign_key :nc_mall_records, :items
end
end