Open janpio opened 4 years ago
I don't know how you ran into this with Chinook. I could only observe this for the database mentioned below.
I am not fully sure what this is about yet, maybe inserting a record with the respective foreign key record not inserted yet.
Internal notes:
Test utils database(s) affected:
2020-03-11T13:57:51.935Z prisma-client prisma.providers_individuals.create({
data: {
credentials: 'zeenejom',
gender: 'ju',
name_first: 'bu',
name_last: 'mahbu',
name_middle: 'wot',
npi: 2
}
})
2020-03-11T13:57:51.935Z prisma-client Generated request:
2020-03-11T13:57:51.935Z prisma-client mutation {
createOneproviders_individuals(data: {
credentials: "zeenejom"
gender: "ju"
name_first: "bu"
name_last: "mahbu"
name_middle: "wot"
npi: 2
}) {
credentials
gender
name_first
name_last
name_middle
npi
}
}
2020-03-11T13:57:52.295Z engine stdout {
timestamp: 'Mar 11 13:57:52.294',
level: 'ERROR',
target: 'prisma',
fields: {
message: 'PANIC',
reason: 'column on null constraint violation error',
file: 'src/libcore/option.rs',
line: 1188,
column: 5
}
}
model providers_individuals {
credentials String?
gender String?
name_first String?
name_last String?
name_middle String?
npi Int @id
@@index([gender], name: "providers_individuals_gender_index")
}
create table providers_individuals
(
npi integer not null
constraint providers_individuals_npi_pk
primary key
constraint providers_individuals_providers_npi_fk
references providers,
name_last text,
name_first text,
name_middle text,
credentials text,
gender text
)
;
create index providers_individuals_gender_index
on providers_individuals (gender)
;
create table providers
(
npi integer not null
constraint providers_npi_pk
primary key,
entity_type text,
provider_type text,
address_street_01 text,
address_street_02 text,
address_city text,
address_zip_code text,
address_state text,
address_country text,
address_latitude numeric,
address_longitude numeric
)
;
The SQL shows that the table providers_individuals
has a PK that is also a FK to the table providers
. That is currently not supported in Prisma, so test-utils does not have any way to find out about that it should insert an existing providers.id here.
When using prisma-test-utils via prisma-test-utils-automation, some databases (schemas from: https://github.com/prisma/database-schema-examples) fail with this error message: