mabel/migrations/20230713090533_add-collection.up.sql
Hamcha 203df76d6c
Some checks failed
continuous-integration/drone/push Build is failing
add collections and private posts
2023-07-13 14:08:26 +02:00

13 lines
466 B
SQL

CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; -- noqa: RF05
CREATE TABLE collections (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
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;