generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes exception caused by #1971 where some references to deleted duplicate entries were hidden within JSON data columns. The two known duplicate entries are updated to their correct values.
- Loading branch information
Showing
4 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,6 @@ def up | |
end | ||
|
||
def down | ||
raise IrreversibleMigration | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ def up | |
end | ||
|
||
def down | ||
raise IrreversibleMigration | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
db/migrate/20241125131721_fix_orphaned_json_fake_foreign_keys.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class FixOrphanedJsonFakeForeignKeys < ActiveRecord::Migration[7.2] | ||
def up | ||
execute <<~SQL | ||
UPDATE support_interactions | ||
SET additional_data = additional_data || '{"assigned_to_agent_id": "9b93fe33-b9f7-417e-a0f8-51cac736b727"}' | ||
WHERE additional_data->'assigned_to_agent_id' @> '"f709fe43-10f9-4dcc-972a-7262bf30911b"' | ||
SQL | ||
execute <<~SQL | ||
UPDATE support_interactions | ||
SET additional_data = additional_data || '{"assigned_to_agent_id": "afb92ef7-e01a-4a63-8797-e52e8dbf428b"}' | ||
WHERE additional_data->'assigned_to_agent_id' @> '"dcda84b8-6329-4c87-90a4-884c0c55113d"' | ||
SQL | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters