question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to remove database name from migrations

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Dr-NULLcommented, Sep 15, 2021

I’m expecting a lot for this update too.

2reactions
imnotjamescommented, Aug 6, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Managing Migrations - EF Core - Microsoft Learn
In your database, delete all rows from the migrations history table; Insert a single row into the migrations history, to record that the...
Read more >
Destroy/Remove database in Rails - Stack Overflow
Yes, Its possible to remove the database and migration. rake db:drop rake db: ...
Read more >
PMC Commands for Migrations in EF Core
Add-Migration <migration name>, Creates a migration by adding a migration snapshot. Remove-Migration, Removes the last migration snapshot. Update-Database ...
Read more >
Database: Migrations - The PHP Framework For Web Artisans
The migrate:fresh command will drop all database tables regardless of their prefix. This command should be used with caution when developing on a...
Read more >
Migrations - Django documentation
Migrations are Django's way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found