feat: URL 正規化(#208) (#226)

#208

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #226
This commit was merged in pull request #226.
This commit is contained in:
2026-01-20 12:39:33 +09:00
parent 16ecbd1fc9
commit 86209dcc84
6 changed files with 83 additions and 6 deletions
@@ -0,0 +1,6 @@
class AddUniqueIndexToUrlInPosts < ActiveRecord::Migration[7.1]
def change
change_column :posts, :url, :string, limit: 768
add_index :posts, :url, unique: true, name: 'index_posts_on_url'
end
end
+3 -2
View File
@@ -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_12_111800) do
ActiveRecord::Schema[8.0].define(version: 2026_01_18_144400) 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
@@ -85,7 +85,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_01_12_111800) do
create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "title"
t.string "url", limit: 2000, null: false
t.string "url", limit: 768, null: false
t.string "thumbnail_base", limit: 2000
t.bigint "parent_id"
t.bigint "uploaded_user_id"
@@ -95,6 +95,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_01_12_111800) do
t.datetime "updated_at", null: false
t.index ["parent_id"], name: "index_posts_on_parent_id"
t.index ["uploaded_user_id"], name: "index_posts_on_uploaded_user_id"
t.index ["url"], name: "index_posts_on_url", unique: true
end
create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|