Conditinal migration issue
elitan opened this issue · 7 comments
Currently, we add a FK to user.id
from uploaded_by_user_id
if the auth.users
table exists. (link)
But I think we run into a race condition here.
If Hasura Storage starts before Hsaura Auth the FK will not be created.
At the same time, it seems like Hasura Storage is trying to add a GraphQL Relationship between the columns when its metadata is being applied:
Causing Hasura metadata to be out of sync:
Either both the migration and the metadata need to be conditional. Or we need to let Storage wait for Auth before it starts and applies its migration and metadata (without conditions).
Yea I think we need to decide if we should allow Storage to run independently of Auth
- if yes: We need to conditionally set metadata for
uploadedByUser
- if no: Storage has to wait for Auth
I'm leaning towards Storage waiting for Auth. This will mean Storage can not work without Auth, which I think is fine.
From what I gather, the idea behind splitting HBP into hasura-auth and hasura-storage was to make them independent from each other.
we could also add a "wait-for" hasura-auth in the hasura-storage k8s deployment resource without changing the hasura-storage code
Storage also has to wait for Auth in our CLI in that case.
How about we make Storage waiting for Auth the default behavior. And then we can let people opt-in to using the two services independently. How does that sound?
After internal discussions we're planning on:
- Never add an FK between files and users table.
- Not add a Hasura metadata relationship between the two columns
Users can manually add the Hasura metadata relationship between the two columns if they want to. It won't affect Auth or Storage.