DEV: Fix bigint notifications id migration to deal with public schema (#28538)

Follow up to 799a45a291
This commit is contained in:
Alan Guo Xiang Tan 2024-08-26 10:25:13 +08:00 committed by GitHub
parent 799a45a291
commit 6832c7b7e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class CopyNotificationsIdIndexes < ActiveRecord::Migration[7.0]
# Copy existing indexes and suffix them with `_bigint`
results =
execute(
"SELECT indexname, indexdef FROM pg_indexes WHERE tablename = 'notifications' AND indexdef SIMILAR TO '%\\mid\\M%'",
"SELECT indexname, indexdef FROM pg_indexes WHERE tablename = 'notifications' AND indexdef SIMILAR TO '%\\mid\\M%' AND schemaname = 'public'",
)
results.each do |res|
indexname, indexdef = res["indexname"], res["indexdef"]

View File

@ -17,7 +17,7 @@ class DropOldNotificationIdIndexes < ActiveRecord::Migration[7.0]
# Remove `_bigint` suffix from indexes
results =
execute(
"SELECT indexname, indexdef FROM pg_indexes WHERE tablename = 'notifications' AND indexdef SIMILAR TO '%\\mid\\M%'",
"SELECT indexname, indexdef FROM pg_indexes WHERE tablename = 'notifications' AND indexdef SIMILAR TO '%\\mid\\M%' AND schemaname = 'public'",
)
results.each do |res|
indexname, indexdef = res["indexname"], res["indexdef"]