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);
