mabel/migrations/20230713090533_add-collection.up.sql

14 lines
439 B
MySQL
Raw Normal View History

2023-07-13 12:08:26 +00:00
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; -- noqa: RF05
CREATE TABLE collections (
2023-07-13 15:43:05 +00:00
id UUID PRIMARY KEY,
2023-07-13 12:08:26 +00:00
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;