Skip to content

Commit

Permalink
fix: some drivers set the wrong database name when defined from url (#…
Browse files Browse the repository at this point in the history
…8058)

the `Driver.database` was getting set only from the options and
completely ignored the connection URLs being passed to them.  this
meant that in some cases the migrations would apply to the wrong
database or schema if connection url strings were used
  • Loading branch information
imnotjames committed Aug 10, 2021
1 parent 65cbcc7 commit a3a3284
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/driver/cockroachdb/CockroachDriver.ts
Expand Up @@ -253,11 +253,9 @@ export class CockroachDriver implements Driver {
return this.createPool(this.options, slave);
}));
this.master = await this.createPool(this.options, this.options.replication.master);
this.database = this.options.replication.master.database;

} else {
this.master = await this.createPool(this.options, this.options);
this.database = this.options.database;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/driver/oracle/OracleDriver.ts
Expand Up @@ -256,11 +256,8 @@ export class OracleDriver implements Driver {
return this.createPool(this.options, slave);
}));
this.master = await this.createPool(this.options, this.options.replication.master);
this.database = this.options.replication.master.database;

} else {
this.master = await this.createPool(this.options, this.options);
this.database = this.options.database;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/driver/postgres/PostgresDriver.ts
Expand Up @@ -297,11 +297,8 @@ export class PostgresDriver implements Driver {
return this.createPool(this.options, slave);
}));
this.master = await this.createPool(this.options, this.options.replication.master);
this.database = this.options.replication.master.database;

} else {
this.master = await this.createPool(this.options, this.options);
this.database = this.options.database;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/driver/sap/SapDriver.ts
Expand Up @@ -257,8 +257,6 @@ export class SapDriver implements Driver {

// create the pool
this.master = this.client.createPool(dbParams, options);

this.database = this.options.database;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/driver/sqlserver/SqlServerDriver.ts
Expand Up @@ -254,11 +254,9 @@ export class SqlServerDriver implements Driver {
return this.createPool(this.options, slave);
}));
this.master = await this.createPool(this.options, this.options.replication.master);
this.database = this.options.replication.master.database;

} else {
this.master = await this.createPool(this.options, this.options);
this.database = this.options.database;
}
}

Expand Down

0 comments on commit a3a3284

Please sign in to comment.