-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from vivid-planet/migrations-in-module
COM-383: Move migrations into module
- Loading branch information
Showing
12 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"@comet/brevo-api": major | ||
--- | ||
|
||
Basic migrations for EmailCampaign and TargetGroup are now available in the module directly. | ||
|
||
They must be imported into the project and added to the `migrationsList` in the `ormConfig`. Migrations for adding the `scope` and `filters` must still be done in the project's migrations. | ||
|
||
```diff | ||
export const ormConfig = createOrmConfig({ | ||
// ... | ||
migrations: { | ||
// ... | ||
- migrationsList: createMigrationsList(path.resolve(__dirname, "migrations")), | ||
+ migrationsList: [...brevoMigrationsList, ...createMigrationsList(path.resolve(__dirname, "migrations"))], | ||
}, | ||
}); | ||
|
||
``` | ||
|
||
**Breaking Changes**: | ||
|
||
- Requires adaption of the project's migrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Migration } from "@mikro-orm/migrations"; | ||
|
||
export class Migration20240802111659 extends Migration { | ||
// this migration needs to be generated manually | ||
async up(): Promise<void> { | ||
this.addSql('alter table "EmailCampaign" add column "scope_domain" text not null, add column "scope_language" text not null;'); | ||
this.addSql( | ||
'alter table "TargetGroup" add column "scope_domain" text not null, add column "scope_language" text not null, add column "filters_SALUTATION" text[] null;', | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
.../db/migrations/Migration20240115095733.ts → ...orm/migrations/Migration20240115095733.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { Migration } from "@mikro-orm/migrations"; | ||
|
||
export class Migration20240115095733 extends Migration { | ||
// TODO: move to package | ||
async up(): Promise<void> { | ||
this.addSql( | ||
'create table "EmailCampaign" ("id" uuid not null, "createdAt" timestamp with time zone not null, "updatedAt" timestamp with time zone not null, "title" text not null, "subject" text not null, "scheduledAt" timestamp with time zone null, "scope_domain" text not null, "scope_language" text not null, "brevoId" int null, "contactList" uuid null, "content" json not null, constraint "Campaign_pkey" primary key ("id"));', | ||
'create table "EmailCampaign" ("id" uuid not null, "createdAt" timestamp with time zone not null, "updatedAt" timestamp with time zone not null, "title" text not null, "subject" text not null, "scheduledAt" timestamp with time zone null, "brevoId" int null, "contactList" uuid null, "content" json not null, constraint "Campaign_pkey" primary key ("id"));', | ||
); | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
.../db/migrations/Migration20240118144808.ts → ...orm/migrations/Migration20240118144808.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
.../db/migrations/Migration20240123145606.ts → ...orm/migrations/Migration20240123145606.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MigrationObject } from "@mikro-orm/core"; | ||
|
||
import { Migration20240115095733 } from "./Migration20240115095733"; | ||
import { Migration20240118144808 } from "./Migration20240118144808"; | ||
import { Migration20240123145606 } from "./Migration20240123145606"; | ||
import { Migration20240527112204 } from "./Migration20240527112204"; | ||
import { Migration20240619092554 } from "./Migration20240619092554"; | ||
import { Migration20240619145217 } from "./Migration20240619145217"; | ||
import { Migration20240621102349 } from "./Migration20240621102349"; | ||
|
||
export const migrationsList: MigrationObject[] = [ | ||
{ name: "Migration20240115095733", class: Migration20240115095733 }, | ||
{ name: "Migration20240118144808", class: Migration20240118144808 }, | ||
{ name: "Migration20240123145606", class: Migration20240123145606 }, | ||
{ name: "Migration20240527112204", class: Migration20240527112204 }, | ||
{ name: "Migration20240619092554", class: Migration20240619092554 }, | ||
{ name: "Migration20240619145217", class: Migration20240619145217 }, | ||
{ name: "Migration20240621102349", class: Migration20240621102349 }, | ||
]; |