-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait for schema changes on execute
and batch
#206
Conversation
406477b
to
8a568be
Compare
I decided to move (at least for now, we can still discuss this!) the code to wait for schema changes to the await schemaClient.execute(
"ALTER TABLE users ADD COLUMN test_column number;",
{ wait: true },
); I think this is a better approach than adding the parameter to // All these operations would be the same
batch('...', { transactionMode: 'write', wait: true })
batch('...', { transactionMode: 'read', wait: true })
batch('...', { transactionMode: 'deferred', wait: true }) This is not bad per se, but having a configuration object parameter with options that can't be mixed doesn't seem the correct way to implement this because it may cause confusion to users. For now, I moved the implementation to I also added some tests for the I've been testing these changes with my own databases using the test file as a reference and it's working as expected, so if everything looks good, I just need to remove the |
Update about the final implementation: we don't require users to manually provide a new parameter like |
batch
execute
and batch
This PR adds an option to
batch
to allow to wait until all schema changes are done:Currently,
batch
supports a transaction mode parameter, so I keep support for it but also added a new object parameter that supports atransactionMode
property. The code below is equivalent:You can test these changes locally with this command:
It builds and run a test using the new
wait
parameter while I add automatic tests.Please note that the API returns frequent 500 errors which are being investigated internally.
If everything works as expected, you should see an output similar to the one below.