Switched Earthquake, Observatory and Artefact creator to a user

This commit is contained in:
Tim Howitz 2025-05-26 14:27:28 +01:00
parent a56579ea0b
commit 8a48857ac0

View File

@ -19,6 +19,9 @@ model User {
scientist Scientist? @relation
purchasedOrders Order[] @relation("UserOrders")
requests Request[] @relation("UserRequests")
earthquakes Earthquake[] @relation("UserEarthquakeCreator")
observatories Observatory[] @relation("UserObservatoryCreator")
artefacts Artefact[] @relation("UserArtefactCreator")
}
model Request {
@ -41,9 +44,6 @@ model Scientist {
superior Scientist? @relation("SuperiorRelation", fields: [superiorId], references: [id], onDelete: NoAction, onUpdate: NoAction)
superiorId Int?
subordinates Scientist[] @relation("SuperiorRelation")
earthquakes Earthquake[] @relation("ScientistEarthquakeCreator")
observatories Observatory[] @relation("ScientistObservatoryCreator")
artefacts Artefact[] @relation("ScientistArtefactCreator")
}
model Earthquake {
@ -59,7 +59,7 @@ model Earthquake {
location String
depth String
creatorId Int?
creator Scientist? @relation("ScientistEarthquakeCreator", fields: [creatorId], references: [id])
creator User? @relation("UserEarthquakeCreator", fields: [creatorId], references: [id])
artefacts Artefact[]
observatories Observatory[] @relation("EarthquakeObservatory")
}
@ -76,7 +76,7 @@ model Observatory {
isFunctional Boolean
seismicSensorOnline Boolean @default(true)
creatorId Int?
creator Scientist? @relation("ScientistObservatoryCreator", fields: [creatorId], references: [id], onDelete: NoAction, onUpdate: NoAction)
creator User? @relation("UserObservatoryCreator", fields: [creatorId], references: [id], onDelete: NoAction, onUpdate: NoAction)
earthquakes Earthquake[] @relation("EarthquakeObservatory")
}
@ -92,7 +92,7 @@ model Artefact {
earthquakeId Int
earthquake Earthquake @relation(fields: [earthquakeId], references: [id])
creatorId Int?
creator Scientist? @relation("ScientistArtefactCreator", fields: [creatorId], references: [id], onDelete: NoAction, onUpdate: NoAction)
creator User? @relation("UserArtefactCreator", fields: [creatorId], references: [id], onDelete: NoAction, onUpdate: NoAction)
isRequired Boolean @default(true)
dateAddedToShop DateTime?
shopPrice Float?