feat(F-112): completed feature

This commit is contained in:
chattie
2026-08-21 13:31:28 +02:00
parent da919d705f
commit 77133c0ecf
16 changed files with 207 additions and 46 deletions

View File

@@ -0,0 +1,20 @@
/**
* Adds `ai_assisted boolean NOT NULL DEFAULT false` to catalog_products so the
* storefront can render a disclaimer when the product was authored or
* assisted by AI (F-112).
*
* @param {import('node-pg-migrate').MigrationBuilder} pgm
*/
export const up = (pgm) => {
pgm.sql(
`ALTER TABLE catalog_products ADD COLUMN IF NOT EXISTS ai_assisted boolean NOT NULL DEFAULT false`,
);
pgm.sql(
`CREATE INDEX IF NOT EXISTS catalog_products_ai_assisted_idx ON catalog_products (ai_assisted) WHERE ai_assisted`,
);
};
export const down = (pgm) => {
pgm.sql(`DROP INDEX IF EXISTS catalog_products_ai_assisted_idx`);
pgm.sql(`ALTER TABLE catalog_products DROP COLUMN IF EXISTS ai_assisted`);
};