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
test(referential-action-set-null): add SQL tests for 1:1, 1:n relations with SET NULL referential actions #15728
Closed
Conversation
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
…T_FUNCTIONAL_MARIADB_URI is not yet defined
…ts for 1:1 NULL relation
jkomyno
changed the title
test(referential-action-set-null): add 'create table' tests for 1:1 NOT NULL relation
test(referential-action-set-null): add SQL tests for 1:1 relations
Oct 10, 2022
jkomyno
changed the title
test(referential-action-set-null): add SQL tests for 1:1 relations
test(referential-action-set-null): add SQL tests for 1:1 relations with SET NULL referential action
Oct 10, 2022
jkomyno
changed the title
test(referential-action-set-null): add SQL tests for 1:1 relations with SET NULL referential action
test(referential-action-set-null): add SQL tests for 1:1 relations with SET NULL referential actions
Oct 10, 2022
Jolg42
reviewed
Oct 10, 2022
packages/client/tests/functional/referential-action-set-null/tests_1-to-1.ts
Outdated
Show resolved
Hide resolved
… process.env.TEST_SKIP_ is defined
…w that postgres fails at runtime
…prisma into jkomyno/referential-action-tests
jkomyno
changed the title
test(referential-action-set-null): add SQL tests for 1:1 relations with SET NULL referential actions
test(referential-action-set-null): add SQL tests for 1:1, 1:n relations with SET NULL referential actions
Oct 10, 2022
…res:10 rather than postgres:14
… (one column NULL, one NOT NULL) for 1:1 and 1:n relations
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To run tests:
cd package/client
pnpm test:functional referential-action-set-null/tests_1-to-1.ts
pnpm test:functional referential-action-set-null/tests_1-to-n.ts
These tests expect the following environment variables (which are already used by the test codebase):
TEST_FUNCTIONAL_MYSQL_URI
TEST_FUNCTIONAL_POSTGRES_URI
TEST_FUNCTIONAL_COCKROACH_URI
(unnecessary whenTEST_SKIP_COCKROACHDB
is defined)TEST_MSSQL_URI
(unnecessary whenTEST_SKIP_MSSQL
is defined)Outcome
postgres
doesn't validate DDL statements that set aSET NULL
referential action on a foreign key constraint whose referenced column (or one of the referenced columns) isNOT NULL
, all other database throw a validation error in this case.postgres
fails at runtime with a not-null constraint violation error whenUPDATE
/DELETE
statements trigger theSET NULL
referential action on a column defined asNOT NULL
sqlserver
fails at runtime on 1:1 NULL relations becauseNULL
conflicts withUNIQUE
indexes in that particular databaseTODOs
cockroach
andpostgres
ininsert + update + delete
testsMigration engine error: db error: ERROR: database “PRISMA_DB_NAME” is being accessed by other users
postgres
:error: database "PRISMA_DB_NAME" does not exist
sqlserver
:Login failed for user 'sa'.
TEST_FUNCTIONAL_MARIADB_URI
in CI as"mysql://root:root@localhost:4306/PRISMA_DB_NAME"