-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix optional embedded for manufacturer (#1750)
Embedded fields can only be optional if all nested fields also are optional. In case of manufacturer only streetNumber is optional.
- Loading branch information
Showing
4 changed files
with
34 additions
and
14 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
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,20 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240223151902 extends Migration { | ||
|
||
async up(): Promise<void> { | ||
this.addSql('delete from "Manufacturer";'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_street" type varchar(255) using ("addressAsEmbeddable_street"::varchar(255));'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_street" set not null;'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_zip" type int using ("addressAsEmbeddable_zip"::int);'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_zip" set not null;'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_country" type varchar(255) using ("addressAsEmbeddable_country"::varchar(255));'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_country" set not null;'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_alternativeAddress_street" type varchar(255) using ("addressAsEmbeddable_alternativeAddress_street"::varchar(255));'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_alternativeAddress_street" set not null;'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_alternativeAddress_zip" type int using ("addressAsEmbeddable_alternativeAddress_zip"::int);'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_alternativeAddress_zip" set not null;'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_alternativeAddress_country" type varchar(255) using ("addressAsEmbeddable_alternativeAddress_country"::varchar(255));'); | ||
this.addSql('alter table "Manufacturer" alter column "addressAsEmbeddable_alternativeAddress_country" set not 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