mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
Create the room and creation time index only where it is missing
The Rust port creates index_messages_on_room_id_and_created_at on boot, under the same name and on the same columns, with CREATE INDEX IF NOT EXISTS. On a database the port opened before this migration ran, db:prepare stopped with "index ... already exists" and the app didn't start. With if_not_exists the migration skips an index that is already there and creates it everywhere else. Databases that already ran the migration don't run it again, and the dumped schema is the same, so db/schema.rb doesn't change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwoX7uRy5vFZSNKJhSqMSG
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class AddRoomIdAndCreatedAtIndexToMessages < ActiveRecord::Migration[8.2]
|
||||
def change
|
||||
add_index :messages, %i[ room_id created_at ]
|
||||
add_index :messages, %i[ room_id created_at ], if_not_exists: true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user