UNPKG

@alphabite/medusa-reviews

Version:

Alphabite's Medusa Reviews Plugin

17 lines 2.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Migration20250620124323 = void 0; const migrations_1 = require("@mikro-orm/migrations"); class Migration20250620124323 extends migrations_1.Migration { async up() { this.addSql(`create table if not exists "review" ("id" text not null, "title" text null, "content" text null, "rating" integer not null, "status" text check ("status" in ('pending', 'approved', 'rejected')) not null default 'pending', "product_id" text not null, "customer_id" text not null, "image_urls" text[] not null default '{}', "is_verified_purchase" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "review_pkey" primary key ("id"));`); this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_REVIEW_PRODUCT_ID" ON "review" (product_id) WHERE deleted_at IS NULL;`); this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_review_deleted_at" ON "review" (deleted_at) WHERE deleted_at IS NULL;`); this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_review_product_id_customer_id" ON "review" (product_id, customer_id) WHERE deleted_at IS NULL;`); } async down() { this.addSql(`drop table if exists "review" cascade;`); } } exports.Migration20250620124323 = Migration20250620124323; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTA2MjAxMjQzMjMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9yZXZpZXcvbWlncmF0aW9ucy9NaWdyYXRpb24yMDI1MDYyMDEyNDMyMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxzREFBa0Q7QUFFbEQsTUFBYSx1QkFBd0IsU0FBUSxzQkFBUztJQUUzQyxLQUFLLENBQUMsRUFBRTtRQUNmLElBQUksQ0FBQyxNQUFNLENBQUMseWlCQUF5aUIsQ0FBQyxDQUFDO1FBQ3ZqQixJQUFJLENBQUMsTUFBTSxDQUFDLHVHQUF1RyxDQUFDLENBQUM7UUFDckgsSUFBSSxDQUFDLE1BQU0sQ0FBQyx1R0FBdUcsQ0FBQyxDQUFDO1FBQ3JILElBQUksQ0FBQyxNQUFNLENBQUMsZ0lBQWdJLENBQUMsQ0FBQztJQUNoSixDQUFDO0lBRVEsS0FBSyxDQUFDLElBQUk7UUFDakIsSUFBSSxDQUFDLE1BQU0sQ0FBQyx3Q0FBd0MsQ0FBQyxDQUFDO0lBQ3hELENBQUM7Q0FFRjtBQWJELDBEQWFDIn0=