Skip to content

Commit b04cf4b

Browse files
committed
Fix migration issue with items_pkey unique constraint, probably
1 parent 11b42bb commit b04cf4b

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

db/migrate/20220920203301_drop_incomplete_items.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class DropIncompleteItems < ActiveRecord::Migration[7.0]
3939

4040
def up
4141
DATA.each { |attrs| Item.find_by!(attrs).destroy! }
42+
ActiveRecord::Base.connection.reset_pk_sequence!('items', :id, 'items_id_seq')
4243
end
4344

4445
def down

db/migrate/20220920213123_add_fall2022_items.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class AddFall2022Items < ActiveRecord::Migration[7.0]
3737

3838
def up
3939
raise ArgumentError, "Missing images:\n\t#{image_errors.join("\n\t")}" if image_errors.any?
40+
ActiveRecord::Base.connection.reset_pk_sequence!('items', :id, 'items_id_seq')
4041
importer.import_items!
4142
end
4243

0 commit comments

Comments
 (0)