mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
Create the room and update time index only where it is missing
The Rust port creates index_messages_on_room_id_and_updated_at on boot, under the same name, with CREATE INDEX IF NOT EXISTS (basecamp/once-campfire-rust#45). On a database the port has opened, this migration stopped db:prepare with "index ... already exists" and the app didn't start. With if_not_exists it skips an index that is already there and creates it everywhere else, and the dumped schema stays the same. 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 AddRoomIdAndUpdatedAtIndexToMessages < ActiveRecord::Migration[8.2]
|
||||
def change
|
||||
add_index :messages, %i[ room_id updated_at ]
|
||||
add_index :messages, %i[ room_id updated_at ], if_not_exists: true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user