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

Shadow vs. main database check does not consider the port #7216

Closed
janpio opened this issue May 22, 2021 · 1 comment · Fixed by prisma/prisma-engines#1985
Closed

Shadow vs. main database check does not consider the port #7216

janpio opened this issue May 22, 2021 · 1 comment · Fixed by prisma/prisma-engines#1985
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: prisma migrate dev CLI: prisma migrate dev topic: shadow database
Milestone

Comments

@janpio
Copy link
Member

janpio commented May 22, 2021

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
  shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}

and

DATABASE_URL="mysql://root:@127.0.0.1:3306/fk-test"
SHADOW_DATABASE_URL="mysql://root:root@127.0.0.1:3316/fk-test"

leads to

Error: Error: The shadow database you configured appears to be the same as as the main database. Please specify another shadow database.

This is wrong, as 3306 is my remote Planetscale DB via proxy, and 3316 is my local MySQL 8.

Seems the check for this is missing to consider the port:

https://github.com/prisma/prisma-engines/blob/340b485a62f6fd071bcd47a33a5263db491df86f/migration-engine/connectors/sql-migration-connector/src/flavour/mysql.rs#L77-L79
https://github.com/prisma/prisma-engines/blob/fd7b031cb9e9ac89b2d15c29f39f704f672da00b/migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs#L48-L50
https://github.com/prisma/prisma-engines/blob/c1113c6285960eb54d71be971738abe600727268/migration-engine/connectors/sql-migration-connector/src/flavour/mssql.rs#L61-L63

PS: Can be worked around by using 127.0.0.1 and localhost as hostnames :)

@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/schema Issue for team Schema. topic: shadow database topic: prisma migrate dev CLI: prisma migrate dev labels May 22, 2021
@janpio janpio changed the title Shadow vs. main database check is missing to consider the port Shadow vs. main database check does not consider the port May 22, 2021
@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels May 27, 2021
@pantharshit00
Copy link
Contributor

I can confirm this.

@tomhoule tomhoule added this to the 2.25.0 milestone Jun 2, 2021
tomhoule added a commit to prisma/prisma-engines that referenced this issue Jun 2, 2021
- Share code between flavours
- Write a test
- Take the port into account when checking whether two databases are the
same

Closes prisma/prisma#7216
tomhoule added a commit to prisma/prisma-engines that referenced this issue Jun 2, 2021
- Share code between flavours
- Write a test
- Fix a typo in the error message ("as as")
- Take the port into account when checking whether two databases are the
same

Closes prisma/prisma#7216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: prisma migrate dev CLI: prisma migrate dev topic: shadow database
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants