chore(): Migration generator fix generated import (#14315)

* chore(): Migration generator fix generated import

* Create two-olives-try.md

* feedback
This commit is contained in:
Adrien de Peretti
2025-12-16 11:11:02 +01:00
committed by GitHub
parent c8a7122ba9
commit d813fc4ff9
24 changed files with 105 additions and 61 deletions

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251208130704 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251114133146 extends Migration {
override async up(): Promise<void> {
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_shipping_option_shipping_option_type_id" ON "shipping_option" ("shipping_option_type_id") WHERE deleted_at IS NULL;`);
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_shipping_option_shipping_option_type_id" ON "shipping_option" ("shipping_option_type_id") WHERE deleted_at IS NULL;`
)
}
override async down(): Promise<void> {
this.addSql(`drop index if exists "IDX_shipping_option_shipping_option_type_id";`);
this.addSql(
`drop index if exists "IDX_shipping_option_shipping_option_type_id";`
)
}
}

View File

@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251121123942 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table if exists "notification" add column if not exists "from" text null;`);
this.addSql(
`alter table if exists "notification" add column if not exists "from" text null;`
)
}
override async down(): Promise<void> {
this.addSql(`alter table if exists "notification" drop column if exists "from";`);
this.addSql(
`alter table if exists "notification" drop column if exists "from";`
)
}
}

View File

@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251121150408 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table if exists "notification" add column if not exists "provider_data" jsonb null;`);
this.addSql(
`alter table if exists "notification" add column if not exists "provider_data" jsonb null;`
)
}
override async down(): Promise<void> {
this.addSql(`alter table if exists "notification" drop column if exists "provider_data";`);
this.addSql(
`alter table if exists "notification" drop column if exists "provider_data";`
)
}
}

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20250910130000 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251016160403 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251125164002 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,13 +1,13 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251210112909 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table if exists "order" add column if not exists "locale" text null;`);
this.addSql(
`alter table if exists "order" add column if not exists "locale" text null;`
)
}
override async down(): Promise<void> {
this.addSql(`alter table if exists "order" drop column if exists "locale";`);
this.addSql(`alter table if exists "order" drop column if exists "locale";`)
}
}

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251210112924 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
import { ulid } from "ulid"
export class Migration20250924135437 extends Migration {

View File

@@ -1,11 +1,9 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20250929124701 extends Migration {
override async up(): Promise<void> {
// Step 1: Add the column as nullable
this.addSql(
`alter table "refund_reason" add column "code" text;`
)
this.addSql(`alter table "refund_reason" add column "code" text;`)
// Step 2: Populate the code column from label (convert to snake_case)
this.addSql(`

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251009110625 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20250910154539 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20250929204438 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251008132218 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20250909083125 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20250916120552 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,4 +1,4 @@
import { Migration } from "@mikro-orm/migrations"
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251015113934 extends Migration {
override async up(): Promise<void> {

View File

@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251107050148 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table if exists "promotion" add column if not exists "metadata" jsonb null;`);
this.addSql(
`alter table if exists "promotion" add column if not exists "metadata" jsonb null;`
)
}
override async down(): Promise<void> {
this.addSql(`alter table if exists "promotion" drop column if exists "metadata";`);
this.addSql(
`alter table if exists "promotion" drop column if exists "metadata";`
)
}
}

View File

@@ -1,17 +1,23 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251202184737 extends Migration {
override async up(): Promise<void> {
this.addSql(`create table if not exists "store_locale" ("id" text not null, "locale_code" text not null, "is_default" boolean not null default false, "store_id" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "store_locale_pkey" primary key ("id"));`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_store_locale_store_id" ON "store_locale" ("store_id") WHERE deleted_at IS NULL;`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_store_locale_deleted_at" ON "store_locale" ("deleted_at") WHERE deleted_at IS NULL;`);
this.addSql(
`create table if not exists "store_locale" ("id" text not null, "locale_code" text not null, "is_default" boolean not null default false, "store_id" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "store_locale_pkey" primary key ("id"));`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_store_locale_store_id" ON "store_locale" ("store_id") WHERE deleted_at IS NULL;`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_store_locale_deleted_at" ON "store_locale" ("deleted_at") WHERE deleted_at IS NULL;`
)
this.addSql(`alter table if exists "store_locale" add constraint "store_locale_store_id_foreign" foreign key ("store_id") references "store" ("id") on update cascade on delete cascade;`);
this.addSql(
`alter table if exists "store_locale" add constraint "store_locale_store_id_foreign" foreign key ("store_id") references "store" ("id") on update cascade on delete cascade;`
)
}
override async down(): Promise<void> {
this.addSql(`drop table if exists "store_locale" cascade;`);
this.addSql(`drop table if exists "store_locale" cascade;`)
}
}

View File

@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251212161429 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table if exists "store_locale" drop column if exists "is_default";`);
this.addSql(
`alter table if exists "store_locale" drop column if exists "is_default";`
)
}
override async down(): Promise<void> {
this.addSql(`alter table if exists "store_locale" add column if not exists "is_default" boolean not null default false;`);
this.addSql(
`alter table if exists "store_locale" add column if not exists "is_default" boolean not null default false;`
)
}
}

View File

@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
export class Migration20251215083927 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table if exists "translation" add column if not exists "translated_field_count" integer not null default 0;`);
this.addSql(
`alter table if exists "translation" add column if not exists "translated_field_count" integer not null default 0;`
)
}
override async down(): Promise<void> {
this.addSql(`alter table if exists "translation" drop column if exists "translated_field_count";`);
this.addSql(
`alter table if exists "translation" drop column if exists "translated_field_count";`
)
}
}