X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1a18f825a86563252e242d479791821941b8cee8..dcdf385b2852acf95f41e2340d07cd68cb34e371:/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb diff --git a/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb b/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb index 5908ab4bc7..590e8413e9 100644 --- a/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb +++ b/services/api/db/migrate/20220401153101_fix_created_at_indexes.rb @@ -8,6 +8,7 @@ class FixCreatedAtIndexes < ActiveRecord::Migration[5.2] def up @@idxtables.each do |table| ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at") + ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_uuid") ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_and_uuid") ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at") ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_uuid") @@ -20,13 +21,7 @@ class FixCreatedAtIndexes < ActiveRecord::Migration[5.2] def down @@idxtables.each do |table| - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_created_at_and_uuid") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at") - ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_uuid") ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_#{table.to_s}_on_modified_at_and_uuid") - - ActiveRecord::Base.connection.execute("CREATE INDEX IF NOT EXISTS index_#{table.to_s}_on_created_at_and_uuid ON #{table.to_s} USING btree (created_at, uuid)") ActiveRecord::Base.connection.execute("CREATE INDEX IF NOT EXISTS index_#{table.to_s}_on_modified_at_uuid ON #{table.to_s} USING btree (modified_at desc, uuid asc)") end end