@tsc_tech/medusa-plugin-restock
Version:
A starter for Medusa plugins.
17 lines • 2.08 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Migration20250401090540 = void 0;
const migrations_1 = require("@mikro-orm/migrations");
class Migration20250401090540 extends migrations_1.Migration {
async up() {
this.addSql(`alter table if exists "restock_subscription" drop constraint if exists "restock_subscription_variant_id_sales_channel_id_email_unique";`);
this.addSql(`create table if not exists "restock_subscription" ("id" text not null, "variant_id" text not null, "sales_channel_id" text not null, "email" text not null, "customer_id" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "restock_subscription_pkey" primary key ("id"));`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_restock_subscription_deleted_at" ON "restock_subscription" (deleted_at) WHERE deleted_at IS NULL;`);
this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_restock_subscription_variant_id_sales_channel_id_email_unique" ON "restock_subscription" (variant_id, sales_channel_id, email) WHERE deleted_at IS NULL;`);
}
async down() {
this.addSql(`drop table if exists "restock_subscription" cascade;`);
}
}
exports.Migration20250401090540 = Migration20250401090540;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTA0MDEwOTA1NDAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9yZXN0b2NrL21pZ3JhdGlvbnMvTWlncmF0aW9uMjAyNTA0MDEwOTA1NDAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQWtEO0FBRWxELE1BQWEsdUJBQXdCLFNBQVEsc0JBQVM7SUFFM0MsS0FBSyxDQUFDLEVBQUU7UUFDZixJQUFJLENBQUMsTUFBTSxDQUFDLHlJQUF5SSxDQUFDLENBQUM7UUFDdkosSUFBSSxDQUFDLE1BQU0sQ0FBQyxtWEFBbVgsQ0FBQyxDQUFDO1FBQ2pZLElBQUksQ0FBQyxNQUFNLENBQUMsbUlBQW1JLENBQUMsQ0FBQztRQUNqSixJQUFJLENBQUMsTUFBTSxDQUFDLGlNQUFpTSxDQUFDLENBQUM7SUFDak4sQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2pCLElBQUksQ0FBQyxNQUFNLENBQUMsc0RBQXNELENBQUMsQ0FBQztJQUN0RSxDQUFDO0NBRUY7QUFiRCwwREFhQyJ9