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

Option to remove database name from migrations #8012

Closed
dotMortis opened this issue Aug 3, 2021 · 9 comments · Fixed by #8038
Closed

Option to remove database name from migrations #8012

dotMortis opened this issue Aug 3, 2021 · 9 comments · Fixed by #8038

Comments

@dotMortis
Copy link

dotMortis commented Aug 3, 2021

Feature Description

Two weeks ago, the name of the database was added to the migration queries.

The Problem

Unfortunately, this does not work for us. We have several systems with different database names (Dev, Staging, Production).
We urgently need an option to disable this behavior.

The Solution

The function needs an option to ignore the database name.

MysqlQueryRunner.ts

  /**
   * Escapes given table or view path.
   */
  protected escapePath(target: Table|View|string): string {
      const { database, tableName } = this.driver.parseTableName(target);

      if (database) {
          return `\`${database}\`.\`${tableName}\``;
      }

      return `\`${tableName}\``;
  }

Relevant Database Driver(s)

Every driver with this behaviour

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.
@csxcode
Copy link

csxcode commented Aug 3, 2021

Yes, I am experimenting this problem too

@pleerock
Copy link
Member

pleerock commented Aug 4, 2021

Two weeks ago, the name of the database was added to the migration queries.

would be great if you find the change set, PR, and ping author of the PR. We need to discuss motivation behind introduced change first.

@dotMortis
Copy link
Author

Sry, I don't know how to link the PR properly.

PR: #7950
@imnotjames

@imnotjames imnotjames self-assigned this Aug 5, 2021
@jmazurpl

This comment has been minimized.

@imnotjames
Copy link
Contributor

The outcome from this was not an intentional change. I've got a PR that's mostly got it fixed but it requires some more work when it comes to MSSQL.

@Dr-NULL
Copy link

Dr-NULL commented Aug 12, 2021

I have this problem too. Normally I use three databases form every project, one for developing, other for testing, and finally another one for production. Before this change, I was simply changes the database name in my ormconfig.json and execute all migrations for the database specified in the json file. But now, I must change the database name in all migrations before to execute all.

@martinsantibanez
Copy link
Contributor

Hi @imnotjames , thanks for the fix.
Is there a release date planned for this? I've noticed that it wasn't on 0.2.37

Thanks

@Dr-NULL
Copy link

Dr-NULL commented Sep 15, 2021

I'm expecting a lot for this update too.

@denes16
Copy link

denes16 commented Oct 19, 2021

When this will be released, we need this, please

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.

8 participants