This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class AddIndexToPostSimilarities < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
remove_index :post_similarities, name: 'index_post_similarities_on_post_id'
|
||||
|
||||
add_index :post_similarities, [:post_id, :cos],
|
||||
order: { cos: :desc },
|
||||
name: 'index_post_similarities_on_post_id_and_cos'
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddIndexToTagSimilarities < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
remove_index :tag_similarities, name: 'index_tag_similarities_on_tag_id'
|
||||
|
||||
add_index :tag_similarities, [:tag_id, :cos],
|
||||
order: { cos: :desc },
|
||||
name: 'index_tag_similarities_on_tag_id_and_cos'
|
||||
end
|
||||
end
|
||||
Generated
+3
-3
@@ -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_024800) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2026_01_21_225600) 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
|
||||
@@ -59,7 +59,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_01_21_024800) do
|
||||
t.bigint "post_id", null: false
|
||||
t.bigint "target_post_id", null: false
|
||||
t.float "cos", null: false
|
||||
t.index ["post_id"], name: "index_post_similarities_on_post_id"
|
||||
t.index ["post_id", "cos"], name: "index_post_similarities_on_post_id_and_cos", order: { cos: :desc }
|
||||
t.index ["target_post_id"], name: "index_post_similarities_on_target_post_id"
|
||||
end
|
||||
|
||||
@@ -130,7 +130,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_01_21_024800) do
|
||||
t.bigint "tag_id", null: false
|
||||
t.bigint "target_tag_id", null: false
|
||||
t.float "cos", null: false
|
||||
t.index ["tag_id"], name: "index_tag_similarities_on_tag_id"
|
||||
t.index ["tag_id", "cos"], name: "index_tag_similarities_on_tag_id_and_cos", order: { cos: :desc }
|
||||
t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user