feat(ADM-018): completed feature

This commit is contained in:
chattie
2026-08-17 22:23:10 +02:00
parent cf1c69fc8b
commit d595b4871f
871 changed files with 47411 additions and 281 deletions

View File

@@ -0,0 +1,27 @@
/**
* Categories module table. Module-owned naming: categories_<table>.
*/
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
export const up = (pgm) => {
pgm.sql(`
CREATE TABLE categories_categories (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
parent_id uuid REFERENCES categories_categories(id) ON DELETE RESTRICT,
name text NOT NULL,
slug text NOT NULL UNIQUE,
seo_title text,
seo_description text,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
CONSTRAINT categories_categories_no_self_parent CHECK (parent_id IS NULL OR parent_id <> id)
)
`);
pgm.sql('CREATE INDEX categories_categories_parent_id_idx ON categories_categories (parent_id)');
pgm.sql('CREATE INDEX categories_categories_slug_idx ON categories_categories (slug)');
};
/** @param {import('node-pg-migrate').MigrationBuilder} pgm */
export const down = (pgm) => {
pgm.sql('DROP TABLE IF EXISTS categories_categories');
};