@tsc_tech/medusa-plugin-wishlist
Version:
A starter for Medusa plugins.
21 lines • 2.83 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Migration20250331043055 = void 0;
const migrations_1 = require("@mikro-orm/migrations");
class Migration20250331043055 extends migrations_1.Migration {
async up() {
this.addSql(`create table if not exists "wishlist" ("id" text not null, "customer_id" text null, "region_id" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "wishlist_pkey" primary key ("id"));`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_wishlist_deleted_at" ON "wishlist" (deleted_at) WHERE deleted_at IS NULL;`);
this.addSql(`create table if not exists "wishlist_item" ("id" text not null, "variant_id" text null, "wishlist_id_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "wishlist_item_pkey" primary key ("id"));`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_wishlist_item_wishlist_id_id" ON "wishlist_item" (wishlist_id_id) WHERE deleted_at IS NULL;`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_wishlist_item_deleted_at" ON "wishlist_item" (deleted_at) WHERE deleted_at IS NULL;`);
this.addSql(`alter table if exists "wishlist_item" add constraint "wishlist_item_wishlist_id_id_foreign" foreign key ("wishlist_id_id") references "wishlist" ("id") on update cascade;`);
}
async down() {
this.addSql(`alter table if exists "wishlist_item" drop constraint if exists "wishlist_item_wishlist_id_id_foreign";`);
this.addSql(`drop table if exists "wishlist" cascade;`);
this.addSql(`drop table if exists "wishlist_item" cascade;`);
}
}
exports.Migration20250331043055 = Migration20250331043055;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAzMzEwNDMwNTUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy93aXNobGlzdC9taWdyYXRpb25zL01pZ3JhdGlvbjIwMjUwMzMxMDQzMDU1LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHNEQUFrRDtBQUVsRCxNQUFhLHVCQUF3QixTQUFRLHNCQUFTO0lBRTNDLEtBQUssQ0FBQyxFQUFFO1FBQ2YsSUFBSSxDQUFDLE1BQU0sQ0FBQyw2UkFBNlIsQ0FBQyxDQUFDO1FBQzNTLElBQUksQ0FBQyxNQUFNLENBQUMsMkdBQTJHLENBQUMsQ0FBQztRQUV6SCxJQUFJLENBQUMsTUFBTSxDQUFDLCtTQUErUyxDQUFDLENBQUM7UUFDN1QsSUFBSSxDQUFDLE1BQU0sQ0FBQyw2SEFBNkgsQ0FBQyxDQUFDO1FBQzNJLElBQUksQ0FBQyxNQUFNLENBQUMscUhBQXFILENBQUMsQ0FBQztRQUVuSSxJQUFJLENBQUMsTUFBTSxDQUFDLDRLQUE0SyxDQUFDLENBQUM7SUFDNUwsQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2pCLElBQUksQ0FBQyxNQUFNLENBQUMseUdBQXlHLENBQUMsQ0FBQztRQUV2SCxJQUFJLENBQUMsTUFBTSxDQUFDLDBDQUEwQyxDQUFDLENBQUM7UUFFeEQsSUFBSSxDQUFDLE1BQU0sQ0FBQywrQ0FBK0MsQ0FBQyxDQUFDO0lBQy9ELENBQUM7Q0FFRjtBQXJCRCwwREFxQkMifQ==