FIX: Remove old seeded prompts. (#17)

We switched to negative integers for seeded prompts, but we also
need to delete the old ones using IDs 1/2/3 if they exist,
 or deploys will fail due to the unique index on the name column.
This commit is contained in:
Roman Rizzi 2023-03-20 12:55:38 -03:00 committed by GitHub
parent 95d7692ae8
commit 54a1694637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# frozen_string_literal: true
class DeleteDuplicatedSeededPrompts < ActiveRecord::Migration[7.0]
def up
DB.exec <<~SQL
DELETE FROM completion_prompts
WHERE (
(id = 1 AND name = 'translate') OR
(id = 2 AND name = 'generate_titles') OR
(id = 3 AND name = 'proofread')
)
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end