medusa-variant-images-updated
Version:
A variant images plugin for Medusa V2.
33 lines • 1.91 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Migration202507041200 = void 0;
const migrations_1 = require("@mikro-orm/migrations");
class Migration202507041200 extends migrations_1.Migration {
async up() {
this.addSql(`
create table if not exists "variant_images" (
"id" text not null,
"variant_id" text not null,
"url" text not null,
"type" text not null, -- e.g. 'thumbnail' or 'media'
"position" int not null default 0,
"created_at" timestamptz not null default now(),
"updated_at" timestamptz not null default now(),
"deleted_at" timestamptz null,
constraint "variant_images_pkey" primary key ("id")
);
`);
// Add a foreign key constraint to the product variant table (adjust table name as needed)
this.addSql(`
alter table "variant_images"
add constraint "variant_images_variant_id_fkey"
foreign key ("variant_id") references "product_variant" ("id")
on update cascade on delete cascade;
`);
}
async down() {
this.addSql('drop table if exists "variant_images" cascade;');
}
}
exports.Migration202507041200 = Migration202507041200;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTA3MDQxMjAwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21vZHVsZXMvdmFyaWFudC1pbWFnZXMtc2V0dGluZ3MvbWlncmF0aW9ucy9NaWdyYXRpb24yMDI1MDcwNDEyMDAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQWlEO0FBRWpELE1BQWEscUJBQXNCLFNBQVEsc0JBQVM7SUFDbEQsS0FBSyxDQUFDLEVBQUU7UUFDTixJQUFJLENBQUMsTUFBTSxDQUFDOzs7Ozs7Ozs7Ozs7S0FZWCxDQUFDLENBQUM7UUFFSCwwRkFBMEY7UUFDMUYsSUFBSSxDQUFDLE1BQU0sQ0FBQzs7Ozs7S0FLWCxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRUQsS0FBSyxDQUFDLElBQUk7UUFDUixJQUFJLENBQUMsTUFBTSxDQUFDLGdEQUFnRCxDQUFDLENBQUM7SUFDaEUsQ0FBQztDQUNGO0FBNUJELHNEQTRCQyJ9