Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(psl): Validation error when shadowDatabaseUrl is identical to ur…
…l or directUrl (#4831) * feat(psl): Validation error when shadowDatabaseUrl is identical to url or directUrl * validation error when shadowUrl identical to either url or directUrl * improve error message for when shadowUrl same as url or directUrl Closes #16628
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
psl/psl/tests/validation/datasource/direct_url_same_as_shadow.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
datasource testds { | ||
provider = "mysql" | ||
url = "mysql://testurl" | ||
directUrl = "mysql://testurl" | ||
shadowDatabaseUrl = "mysql://testurl" | ||
} | ||
|
||
// [1;91merror[0m: [1mshadowDatabaseUrl is the same as directUrl for datasource "testds". Please specify a different database as shadow database to avoid data loss.[0m | ||
// [1;94m-->[0m [4mschema.prisma:4[0m | ||
// [1;94m | [0m | ||
// [1;94m 3 | [0m url = "mysql://testurl" | ||
// [1;94m 4 | [0m directUrl = [1;91m"mysql://testurl"[0m | ||
// [1;94m | [0m | ||
// [1;91merror[0m: [1mshadowDatabaseUrl is the same as url for datasource "testds". Please specify a different database as shadow database to avoid data loss.[0m | ||
// [1;94m-->[0m [4mschema.prisma:3[0m | ||
// [1;94m | [0m | ||
// [1;94m 2 | [0m provider = "mysql" | ||
// [1;94m 3 | [0m url = [1;91m"mysql://testurl"[0m | ||
// [1;94m | [0m |
12 changes: 12 additions & 0 deletions
12
psl/psl/tests/validation/datasource/url_same_as_shadow.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
datasource testds { | ||
provider = "mysql" | ||
url = "mysql://testurl" | ||
shadowDatabaseUrl = "mysql://testurl" | ||
} | ||
|
||
// [1;91merror[0m: [1mshadowDatabaseUrl is the same as url for datasource "testds". Please specify a different database as shadow database to avoid data loss.[0m | ||
// [1;94m-->[0m [4mschema.prisma:3[0m | ||
// [1;94m | [0m | ||
// [1;94m 2 | [0m provider = "mysql" | ||
// [1;94m 3 | [0m url = [1;91m"mysql://testurl"[0m | ||
// [1;94m | [0m |