mabel/migrations/20230713090533_add-collection.up.sql
Hamcha 81134dc0dd
Some checks failed
continuous-integration/drone/push Build is failing
add cursor and move to uuidv7
2023-07-13 17:43:05 +02:00

13 lines
439 B
SQL

CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; -- noqa: RF05
CREATE TABLE collections (
id UUID PRIMARY KEY,
site UUID NOT NULL REFERENCES sites (id) ON DELETE CASCADE,
slug VARCHAR NOT NULL,
name VARCHAR NOT NULL,
parent UUID REFERENCES collections (id) ON DELETE CASCADE
);
ALTER TABLE pages
ADD COLUMN collections UUID [] NOT NULL DEFAULT array[]::UUID[], -- noqa
ADD COLUMN published BOOLEAN NOT NULL DEFAULT FALSE;