Skip to content

Commit

Permalink
Fix brevo config migrations (#279)
Browse files Browse the repository at this point in the history
Co-authored-by: raphaelblum <44967610+raphaelblum@users.noreply.github.com>
  • Loading branch information
juliawegmayr and raphaelblum authored Feb 21, 2025
1 parent 31db55b commit c20792a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/selfish-years-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/brevo-api": patch
---

Remove `scope` from `BrevoConfig` database migration in module

A custom database migration must be created in the project to add individual `scope` columns to `BrevoConfig`.
11 changes: 11 additions & 0 deletions demo/api/src/db/migrations/Migration20250221074620.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Migration } from "@mikro-orm/migrations";

export class Migration20250221074620 extends Migration {
// this migration needs to be generated manually
async up(): Promise<void> {
this.addSql(
`alter table "BrevoConfig" add column "scope_domain" text not null default 'main', add column "scope_language" text not null default 'en';`,
);
this.addSql(`alter table "BrevoConfig" alter column "scope_domain" drop default, alter column "scope_language" drop default;`);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Migration } from "@mikro-orm/migrations";

export class Migration20250221073825 extends Migration {
async up(): Promise<void> {
this.addSql('alter table "BrevoConfig" drop column "scope_domain", drop column "scope_language";');
}
}
2 changes: 2 additions & 0 deletions packages/api/src/mikro-orm/migrations/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Migration20241018110515 } from "./Migration20241018110515";
import { Migration20241022144400 } from "./Migration20241022144400";
import { Migration20241024071748 } from "./Migration20241024071748";
import { Migration20241119101706 } from "./Migration20241119101706";
import { Migration20250221073825 } from "./Migration20250221073825";

export const migrationsList: MigrationObject[] = [
{ name: "Migration20240115095733", class: Migration20240115095733 },
Expand All @@ -30,4 +31,5 @@ export const migrationsList: MigrationObject[] = [
{ name: "Migration20241119101706", class: Migration20241119101706 },
{ name: "Migration20241022144400", class: Migration20241022144400 },
{ name: "Migration20241024071748", class: Migration20241024071748 },
{ name: "Migration20250221073825", class: Migration20250221073825 },
];

0 comments on commit c20792a

Please sign in to comment.