Add band and venue follows with concert diary
This commit is contained in:
@@ -193,3 +193,37 @@ CREATE INDEX idx_concert_photos_concert
|
||||
|
||||
CREATE INDEX idx_concert_attendance_concert
|
||||
ON concert_attendance(concert_id, status);
|
||||
|
||||
CREATE TABLE followed_bands (
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
band_key VARCHAR(255) NOT NULL,
|
||||
display_name VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (user_id, band_key)
|
||||
);
|
||||
|
||||
CREATE TABLE followed_venues (
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
venue_id INTEGER NOT NULL REFERENCES venues(id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (user_id, venue_id)
|
||||
);
|
||||
|
||||
CREATE TABLE concert_diary (
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
|
||||
rating SMALLINT NOT NULL CHECK (rating BETWEEN 1 AND 5),
|
||||
favorite_song VARCHAR(255),
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (user_id, concert_id)
|
||||
);
|
||||
|
||||
CREATE TABLE concert_bands (
|
||||
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
|
||||
band_key VARCHAR(255) NOT NULL,
|
||||
display_name VARCHAR(255) NOT NULL,
|
||||
position SMALLINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (concert_id, band_key)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user