feat(ADM-018): completed feature
This commit is contained in:
22
project/migrations/020_cms.js
Normal file
22
project/migrations/020_cms.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/** CMS pages with slug routing and draft/publish states. */
|
||||
|
||||
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
|
||||
export const up = (pgm) => {
|
||||
pgm.sql(`
|
||||
CREATE TABLE cms_pages (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
slug text NOT NULL UNIQUE,
|
||||
title text NOT NULL,
|
||||
body text NOT NULL,
|
||||
status text NOT NULL DEFAULT 'draft',
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT cms_pages_status_check CHECK (status IN ('draft','published'))
|
||||
)
|
||||
`);
|
||||
};
|
||||
|
||||
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
|
||||
export const down = (pgm) => {
|
||||
pgm.sql('DROP TABLE IF EXISTS cms_pages');
|
||||
};
|
||||
Reference in New Issue
Block a user