Create Residents table #78
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: pantheon/hestia#78
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "36-create-residents"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
✅ Deploy Preview for hestia-home ready!
513cbee8e8Toggle QR Code...
Use your smartphone camera to open QR code link.
To edit notification comments on pull requests, go to your Netlify site configuration.
@ -34,0 +40,4 @@phoneNumber StringcreatedAt DateTime @default(now())updatedAt DateTime @updatedAtMissing the tenantId
@ -34,0 +40,4 @@phoneNumber StringcreatedAt DateTime @default(now())updatedAt DateTime @updatedAtFix, thanks!
it should be required
hmm why does it do an onDelete set null
I believe this is normal
https://github.com/prisma/prisma/issues/16228
@ -0,0 +11,4 @@);-- AddForeignKeyALTER TABLE "Resident" ADD CONSTRAINT "Resident_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;Feel like it should be ON DELETE CASACADE but maybe it is prisma generating this
It shouldn't be unique
@ -0,0 +11,4 @@);-- AddForeignKeyALTER TABLE "Resident" ADD CONSTRAINT "Resident_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;Cascade needs to be explicitly specified, I could see the desire to add that, but I can also see how it might be dangerous. If a tenant is accidentally deleted then it would cascade to all related tables and nuke a tenant completely, whereas with RESTRICT it would prevent this. Child tables would need to be removed FIRST before the parent, this would be a more explicit operation that would be less likely to be run on accident.
Thanks for coming to my Ted talk
@ -32,2 +32,4 @@}model Resident {id String @id @default(uuid())It should be marked as unique to ensure no duplicate residents
@ -32,2 +32,4 @@}model Resident {id String @id @default(uuid())@id is unique
@ -0,0 +11,4 @@);-- AddForeignKeyALTER TABLE "Resident" ADD CONSTRAINT "Resident_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;If a tenant is deleted it means they want their data out of the platform. Not making it cascade delete just makes it harder to fully delete a tenant data. ( You could protect the data with an appropriate backup policy and db roles)
Cascade delete helps a lot when you setup your integration test and you delete your test tenant after each test, it makes the clean up of the test much easier.