feat(F-112): completed feature
This commit is contained in:
20
project/migrations/040_product_ai_assisted.js
Normal file
20
project/migrations/040_product_ai_assisted.js
Normal 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`);
|
||||
};
|
||||
Reference in New Issue
Block a user