17 lines
777 B
MySQL
17 lines
777 B
MySQL
|
|
-- recordings
|
||
|
|
CREATE TABLE recordings_plays(
|
||
|
|
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||
|
|
recording_id VARCHAR(64) NOT NULL REFERENCES recordings(id) ON DELETE CASCADE,
|
||
|
|
player_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||
|
|
);
|
||
|
|
|
||
|
|
-- sessions
|
||
|
|
CREATE TABLE sessions_plays (
|
||
|
|
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||
|
|
music_session_id VARCHAR(64) NOT NULL REFERENCES music_sessions(id) ON DELETE CASCADE,
|
||
|
|
player_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||
|
|
);
|