OneSignalDevelopers / ngosi

Share your slides with a QR code
https://ngosi.io
MIT License
9 stars 5 forks source link

Fix ordering of initial schema to support migrations #72

Closed jmadler closed 2 years ago

jmadler commented 2 years ago

Fix ordering of initial schema to support migration use cases.

In this case, some table create statements were referring to others that were not yet created. This is a matter of ordering of statements so that dependencies are declared before they are used.

This appears to be caused by an upstream bug, perhaps in supabase, PostgreSQL, or its SQL dump tooling. This PR should resolve the issue for our repository.

The error was observed was while running supabase start:

Error: Error starting database: ERROR: relation "public.Attendee" does not exist

I had to move the Attendee create statement towards the top of the file, and then follow along with dependents of Attendee (Preso, profiles). It appeared to possibly be in reverse-order.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/onesignaldevs/ngosi/HfC54cNgw8FonBSNicH4z52MxCzk
✅ Preview: https://ngosi-git-schemafix-onesignaldevs.vercel.app

iAmWillShepherd commented 2 years ago

I'm just gonna accept this and deal with the consequences 😅

iAmWillShepherd commented 2 years ago

Seems to have worked without issue, so I think we're good! 👍🏾