Skip to content

Commit

Permalink
fix: adds entity-schema support for createForeignKeyConstraints (#8606)
Browse files Browse the repository at this point in the history
Closes: #8489
  • Loading branch information
macwatrousdd committed Feb 12, 2022
1 parent 4208393 commit f224f24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/entity-schema/EntitySchemaRelationOptions.ts
Expand Up @@ -48,6 +48,13 @@ export interface EntitySchemaRelationOptions {
*/
primary?: boolean;

/**
* Indicates whether foreign key constraints will be created for join columns.
* Can be used only for many-to-one and owner one-to-one relations.
* Defaults to true.
*/
createForeignKeyConstraints?: boolean;

/**
* Join table options of this column. If set to true then it simply means that it has a join table.
*/
Expand Down
1 change: 1 addition & 0 deletions src/entity-schema/EntitySchemaTransformer.ts
Expand Up @@ -137,6 +137,7 @@ export class EntitySchemaTransformer {
onUpdate: relationSchema.onUpdate,
deferrable: relationSchema.deferrable,
primary: relationSchema.primary,
createForeignKeyConstraints: relationSchema.createForeignKeyConstraints,
persistence: relationSchema.persistence,
orphanedRowAction: relationSchema.orphanedRowAction
}
Expand Down

0 comments on commit f224f24

Please sign in to comment.