Fix missing unique index on keypairs URI (#39668)
This commit is contained in:
1 parent
b33795c6b7
commit
3aa3b75da9
5 files changed
+28
-20
No files matched your search
@@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddNewIndexOnUriToKeypairs < ActiveRecord::Migration[8.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :keypairs, :uri, name: :index_keypairs_on_non_null_uri, unique: true, where: 'uri IS NOT NULL', algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoveOldIndexOnUriFromKeypair < ActiveRecord::Migration[8.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
remove_index :keypairs, :uri, name: :index_keypairs_on_uri, unique: true, algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RevertAddNewIndexOnUriToKeypairs < ActiveRecord::Migration[8.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
return unless index_exists?(:keypairs, :uri, name: :index_keypairs_on_non_null_uri)
|
||||
|
||||
remove_index :keypairs, :uri, name: :index_keypairs_on_non_null_uri
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RevertRemoveOldIndexOnUriFromKeypair < ActiveRecord::Migration[8.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
return if index_exists?(:keypairs, :uri, name: :index_keypairs_on_uri)
|
||||
|
||||
add_index :keypairs, :uri, name: :index_keypairs_on_uri, unique: true, algorithm: :concurrently
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_06_29_125939) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_06_30_070600) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
@@ -714,7 +714,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_06_29_125939) do
|
||||
t.string "uri"
|
||||
t.index ["account_id", "local_fragment"], name: "index_keypairs_on_account_id_and_local_fragment", unique: true, where: "(local_fragment IS NOT NULL)"
|
||||
t.index ["account_id"], name: "index_keypairs_on_account_id"
|
||||
t.index ["uri"], name: "index_keypairs_on_non_null_uri", unique: true, where: "(uri IS NOT NULL)"
|
||||
t.index ["uri"], name: "index_keypairs_on_uri", unique: true
|
||||
end
|
||||
|
||||
create_table "list_accounts", force: :cascade do |t|
|
||||
|
||||
Reference in new issue
Block a user