Open graeme-verticalscope opened 1 year ago
Hi @graeme-verticalscope,
As you might have suspected, this behavior isn't actually due to wrench but is caused by cloud.google.com/go/spanner.
When wrench applies migrations, it uses the spansql package from cloud.google.com/go/spanner to parse and re-output the DDL. This spansql automatically adds ON DELETE NO ACTION
as its default behavior when it parses a DDL that doesn't explicitly provide a foreign key action. (Regrettably, I was who implemented this behavior on https://github.com/googleapis/google-cloud-go/pull/8296. My apologies.)
I'll create a Pull Request on cloud.google.com/go/spanner to address this behavior. Once a new version of cloud.google.com/go/spanner including this fix is released, upgrading to that version should resolve the issue.
Great, thanks!
hey @toga4 do you know when the fix might get released for this?
I'm stuck on older versions of a few google dependencies until this is fixed, because they all try to upgrade google-cloud-go/spanner
which breaks my CI flow.
Hi @graeme-verticalscope, I have already created a PR at https://github.com/googleapis/google-cloud-go/pull/8968 addressing this issue. However, since I am not a maintainer of that repository, I'm unable to influence its review process directly. It would be greatly appreciated if you could comment on the PR to encourage the maintainers to review it.
Found a workaround to enable upgrading wrench to v1.6.0
. Spanner emulator version v1.5.10
works (although older or newer spanner emulator versions don't work).
See https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/issues/147#issuecomment-1839184657
Expected Behavior
When a table is created with a foreign key constraint and no foreign key action is provided, wrench should not add
ON DELETE NO ACTION
to the create table statement.Current Behavior
Wrench adds
ON DELETE NO ACTION
, changing the statement syntax.Steps to Reproduce
script 2:
This error demonstrates that
ON DELETE NO ACTION
is being added by wrench. If it wasn't being added by wrench, then second migration would succeed.Context (Environment)
v1.6.0
v1.47.0
tov1.49.0
v1.5.0
if I upgrade cloud.google.com/go/spanner tov1.49.0
.This change breaks my local and CI environments that use the emulator:
I have already created an issue in cloud spanner emulator: https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/issues/142 but I was told the fix should be on the wrench side, not the emulator side.