api/migrations/2023-12-30-162032_playlists/up.sql
2023-12-31 01:21:07 +01:00

16 lines
393 B
SQL

CREATE TABLE IF NOT EXISTS playlists
(
id VARCHAR(24) DEFAULT nanoid(24),
name VARCHAR(255) NOT NULL,
creator_id VARCHAR(24) NOT NULL,
created_at TIMESTAMP DEFAULT now() NOT NULL,
updated_at TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY (creator_id)
REFERENCES users (id)
);
CREATE INDEX ON playlists (creator_id);