-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Labels
Description
Issue description
The schema from connection options is not set as the current schema
Expected Behavior
I would expect any query that I run via a QueryRunner or directly using the data source to be run in the schema that is set in the data source options (unless, of course, a SET SCHEMA statement is executed).
Actual Behavior
All queries are executed in the user's default schema, regardless of the schema set in data source options.
Steps to reproduce
const connection = new DataSource({
type: "sap",
username: "MY_USER",
schema: "MY_SCHEMA",
...
});
await connection.initialize();
console.log(await connection.query(`SELECT CURRENT_SCHEMA FROM SYS.DUMMY`); // returns MY_USER instead of MY_SCHEMAMy Environment
| Dependency | Version |
|---|---|
| Operating System | any |
| Node.js version | 20.10.0 |
| Typescript version | 5.3.3 |
| TypeORM version | 0.3.19 |
Additional Context
Since #10123 was merged, migrations and e.g. QueryRunner.createTable are no longer working when the schema is different than the user name.
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.