-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
Feature Description
Allow the user to explicitly define the name of the index for the discriminator column of a Single Table Inheritance (STI) table.
Currently, TypeORM automatically generates an index for the discriminator column of a STI table.
Attempting to explicitly define an index for the discriminator column will result in 2 indices for the same column being created, which leads to a database error when the migration is run.
The Solution
Automatically detect whether the user is already defining the discriminator column index explicitly, on the EntityMetadataBuilder#createKeysForTableInheritance method.
If so, the method should do an early exit. Otherwise, automatically generate the index as it is currently done.
Considered Alternatives
Currently, there is no workaround for those who wish to have their databases synced with TypeORM's entities while specifying the name of the discriminator column index.
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.