api/migrations/2023-12-30-162032_playlists/up.sql

21 lines
604 B
MySQL
Raw Permalink Normal View History

2024-01-07 14:43:56 +00:00
create type playlist_type as enum ('playlist', 'folder');
2024-01-01 02:18:33 +00:00
create table if not exists playlists
2023-12-31 00:21:07 +00:00
(
2024-01-01 02:18:33 +00:00
id varchar(24) default nanoid(24),
name varchar(255) not null,
2024-01-01 22:58:26 +00:00
public bool default false not null,
2024-01-07 14:43:56 +00:00
type playlist_type default 'playlist' not null,
2023-12-31 00:21:07 +00:00
2024-01-01 02:18:33 +00:00
creator_id varchar(24) not null,
2024-01-07 14:43:56 +00:00
parent_id varchar(24) references playlists (id) on delete set null,
2023-12-31 00:21:07 +00:00
2024-01-01 22:58:26 +00:00
created_at timestamp default now(),
2024-01-01 02:18:33 +00:00
updated_at timestamp,
2023-12-31 00:21:07 +00:00
2024-01-01 02:18:33 +00:00
primary key (id),
foreign key (creator_id)
references users (id)
on delete cascade
2023-12-31 00:21:07 +00:00
);