From a7bd53d55ae8385fc0d95ec5daabed94cd76d09f Mon Sep 17 00:00:00 2001 From: miteruzo Date: Mon, 26 Jan 2026 12:47:14 +0900 Subject: [PATCH] #229 --- .../migrate/20260126124100_add_unique_index_to_ip_addresses.rb | 3 +++ backend/db/schema.rb | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 backend/db/migrate/20260126124100_add_unique_index_to_ip_addresses.rb diff --git a/backend/db/migrate/20260126124100_add_unique_index_to_ip_addresses.rb b/backend/db/migrate/20260126124100_add_unique_index_to_ip_addresses.rb new file mode 100644 index 0000000..7d33f09 --- /dev/null +++ b/backend/db/migrate/20260126124100_add_unique_index_to_ip_addresses.rb @@ -0,0 +1,3 @@ +class AddUniqueIndexToIpAddresses < ActiveRecord::Migration[8.0] + add_index :ip_addresses, :ip_address, unique: true, name: 'index_ip_addresses_on_ip_address' +end diff --git a/backend/db/schema.rb b/backend/db/schema.rb index c6fc0ed..180735e 100644 --- a/backend/db/schema.rb +++ b/backend/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2026_01_21_225600) do +ActiveRecord::Schema[8.0].define(version: 2026_01_26_124100) do create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -44,6 +44,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_01_21_225600) do t.boolean "banned", default: false, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["ip_address"], name: "index_ip_addresses_on_ip_address", unique: true end create_table "nico_tag_relations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|