-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
Issue description
view+schema broken for oracle
Expected Behavior
When caller defines schema from connection options and defines a @ViewEntity, the Oracle driver should set that configured schema into typeorm_metadata.schema and should set the view's name into typeorm_metadata.name.
This allows subsequent executions of synchronize to recognize whether the view already exists and not to crash with ORA-00955 errors.
Actual Behavior
When caller defines schema from connection options and defines a @ViewEntity, the Oracle driver incorrectly sets typeorm_metadata.schema to null and typeorm_metadata.name to "${schema}.${view_name}".
This allows synchronize to execute once without apparent problem, but upon subsequent executions, the application produces errors similar to the following:
query failed:CREATE VIEW "myView" AS ...
Error: ORA-00955: name is already used by an existing object
Steps to reproduce
- add any @ViewEntity to your project
- configure Oracle datasource with a schema set to upper-cased database username
- run
typeorm schema:sync(or similar) twice against an initially empty Oracle database.
My Environment
| Dependency | Version |
|---|---|
| Operating System | macos 12.5.1 |
| Node.js version | 16.15.1 |
| Typescript version | 4.5.2 |
| TypeORM version | 0.3.10 |
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.