VRFS-81 recordings and favorites
This commit is contained in:
parent
12e72d8c5f
commit
b450620433
4
manifest
4
manifest
|
|
@ -14,4 +14,6 @@ first_last_name.sql
|
|||
account_fields.sql
|
||||
signup.sql
|
||||
bootstrap_users_v2.sql
|
||||
drop_users_name.sql
|
||||
drop_users_name.sql
|
||||
recordings.sql
|
||||
favorites.sql
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE users_favorites (
|
||||
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
user_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
recording_id VARCHAR(64) NOT NULL REFERENCES recordings(id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
ALTER TABLE users_favorites ADD CONSTRAINT user_favorite_uniqkey UNIQUE (user_id, recording_id);
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
CREATE TABLE recordings (
|
||||
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
description VARCHAR(200) NOT NULL,
|
||||
public BOOLEAN NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE musicians_recordings (
|
||||
user_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
recording_id VARCHAR(64) NOT NULL REFERENCES recordings(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
ALTER TABLE musicians_recordings ADD CONSTRAINT musician_recording_uniqkey UNIQUE (user_id, recording_id);
|
||||
|
||||
CREATE TABLE bands_recordings (
|
||||
band_id VARCHAR(64) NOT NULL REFERENCES bands(id) ON DELETE CASCADE,
|
||||
recording_id VARCHAR(64) NOT NULL REFERENCES recordings(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
ALTER TABLE bands_recordings ADD CONSTRAINT band_recording_uniqkey UNIQUE (band_id, recording_id);
|
||||
Loading…
Reference in New Issue