Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createForeignKeyConstraints is not present in EntitySchemaRelationOptions #8489

Closed
Clad012 opened this issue Dec 29, 2021 · 0 comments · Fixed by #8606
Closed

createForeignKeyConstraints is not present in EntitySchemaRelationOptions #8489

Clad012 opened this issue Dec 29, 2021 · 0 comments · Fixed by #8606

Comments

@Clad012
Copy link

Clad012 commented Dec 29, 2021

Issue Description

Expected Behavior

Hello, i saw that now we can, for performance reasons, disable foreign key constraint. by setting createForeignKeyConstraints option to false (default: true).

Actual Behavior

I actually using EntitySchemaRelationOptions, and i wanted to disable foreign key constraints but this option is not implemented in EntitySchemaRelationOptions

My code :

export const ORGANISATIONS_TABLE = 'organisations';

export const OrganisationsSchema = new EntitySchema<OrganisationsEntity>({
  columns: {
    ...BaseColumnSchema,
    description: {
      nullable: true,
      type: String,
    },
    domainCode: {
      nullable: true,
      type: String,
    },
    id: {
      primary: true,
      type: String,
    },
    name: {
      nullable: false,
      type: String,
    },
  },
  name: ORGANISATIONS_TABLE,
  relations: {
    teams: {
      createForeignKeyConstraints: false, // this option is not implemented
      nullable: true,
      target: () => TeamsEntity,
      type: 'one-to-many',
    },
    labels: {
      nullable: true,
      target: () => UsersEntity,
      type: 'one-to-many',
    },
    users: {
      nullable: true,
      target: () => UsersEntity,
      type: 'one-to-many',
    },
  },
  target: OrganisationsEntity,
});

My Environment

Dependency Version
Operating System macOs Mojave 10.14.6
Node.js version v14.16.0
Typescript version 4.4.3
TypeORM version 0.2.41

Additional Context

Is it possible to add createForeignKeyConstraints option to EntitySchemaRelationOptions ?

Relevant Database Driver(s)

DB Type Reproducible
aurora-data-api no
aurora-data-api-pg no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres yes
react-native no
sap no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant