migrate db for events

This commit is contained in:
Mitchell Marino 2023-04-05 19:02:48 -05:00
parent c786b36cd3
commit 579fdb4dd0

View File

@ -0,0 +1,21 @@
CREATE TYPE event_type AS ENUM ('sports', 'meetings', 'drama', 'music', 'other');
CREATE TABLE events (
id SERIAL PRIMARY KEY,
title VARCHAR(255),
time_start TIMESTAMP,
time_end TIMESTAMP,
event_type event_type,
points INTEGER,
place VARCHAR(255),
price DECIMAL(10, 2),
created_by INTEGER REFERENCES users(id)
);
CREATE TABLE event_attendees (
event_id INTEGER REFERENCES events(id),
user_id INTEGER REFERENCES users(id),
PRIMARY KEY (event_id, user_id)
);
CREATE INDEX idx_event_attendees ON event_attendees(event_id);