1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 04:38:48 +03:00

deploy: fix load-schemas paths; add 080_sfu_rooms migration

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-06-28 22:41:22 +02:00
parent 386f7ab793
commit 9edcd44689
2 changed files with 60 additions and 4 deletions

View File

@@ -0,0 +1,38 @@
-- SFU room management schema — MariaDB / SQLite default
-- Created: 2026-06-28
CREATE TABLE IF NOT EXISTS sfu_rooms (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
janus_room_id INT NOT NULL UNIQUE,
owner_id BIGINT UNSIGNED NOT NULL,
name VARCHAR(128) NOT NULL DEFAULT '',
purpose VARCHAR(32) NOT NULL DEFAULT 'screen_cast',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
closed_at DATETIME NULL,
INDEX idx_sfu_rooms_owner (owner_id),
INDEX idx_sfu_rooms_closed (closed_at)
);
CREATE TABLE IF NOT EXISTS sfu_participants (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
room_id BIGINT UNSIGNED NOT NULL,
user_id BIGINT UNSIGNED NOT NULL,
janus_handle_id BIGINT UNSIGNED NOT NULL,
role VARCHAR(16) NOT NULL DEFAULT 'publisher',
joined_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
left_at DATETIME NULL,
INDEX idx_sfup_room (room_id),
INDEX idx_sfup_user (user_id),
INDEX idx_sfup_joined (joined_at)
);
CREATE TABLE IF NOT EXISTS sfu_stats (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
participant_id BIGINT UNSIGNED NOT NULL,
bitrate_kbps DECIMAL(10,2) NOT NULL DEFAULT 0,
packet_loss DECIMAL(5,2) NOT NULL DEFAULT 0,
sampled_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_sfustat_participant (participant_id),
INDEX idx_sfustat_time (sampled_at)
);