- MATRIX_ROOMS_BRIDGE_SPEC.md documentation - Migration 012: Add matrix_room_id/alias to city_rooms - Matrix Gateway service (port 7025) - City-service: auto-create Matrix rooms on room creation - Backfill endpoint for existing rooms - API returns matrix_room_id/alias in room responses
22 lines
821 B
SQL
22 lines
821 B
SQL
-- Migration 012: Add Matrix fields to city_rooms
|
|
-- MATRIX ROOMS BRIDGE - link City Rooms to Matrix rooms
|
|
|
|
-- Add Matrix room fields
|
|
ALTER TABLE city_rooms
|
|
ADD COLUMN IF NOT EXISTS matrix_room_id TEXT,
|
|
ADD COLUMN IF NOT EXISTS matrix_room_alias TEXT;
|
|
|
|
-- Create unique indexes (only for non-null values)
|
|
CREATE UNIQUE INDEX IF NOT EXISTS city_rooms_matrix_room_id_uq
|
|
ON city_rooms (matrix_room_id)
|
|
WHERE matrix_room_id IS NOT NULL;
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS city_rooms_matrix_room_alias_uq
|
|
ON city_rooms (matrix_room_alias)
|
|
WHERE matrix_room_alias IS NOT NULL;
|
|
|
|
-- Add comments for documentation
|
|
COMMENT ON COLUMN city_rooms.matrix_room_id IS 'Matrix room ID (e.g., !abc123:daarion.space)';
|
|
COMMENT ON COLUMN city_rooms.matrix_room_alias IS 'Matrix room alias (e.g., #city_general:daarion.space)';
|
|
|