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
- Create 2 migration scripts
script 1:
CREATE TABLE Table1 (
Table1ID STRING(MAX) NOT NULL,
) PRIMARY KEY(Table1ID);
script 2:
CREATE TABLE Table2 (
Table2ID STRING(MAX) NOT NULL,
Table1ID STRING(MAX) NOT NULL,
CONSTRAINT FK_Table1Table2 FOREIGN KEY(Table1ID) REFERENCES Table1(Table1ID)
) PRIMARY KEY(Table2ID);
- Create a local spanner instance with cloud spanner emulator
- Apply migrations to cloud spanner emulator using wrench.
- Second migration fails with the following error:
Foreign key referential action ON DELETE NO ACTION is not supported.
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)
- wrench version:
v1.6.0
- possibly caused by dependency cloud.google.com/go/spanner upgrade from
v1.47.0 to v1.49.0
- I can reproduce with wrench
v1.5.0 if I upgrade cloud.google.com/go/spanner to v1.49.0.
This change breaks my local and CI environments that use the emulator:
- The emulator does not accept create table statements with foreign key actions
- I cannot remove the foreign key action, since it's being added by wrench.
I have already created an issue in cloud spanner emulator: GoogleCloudPlatform/cloud-spanner-emulator#142 but I was told the fix should be on the wrench side, not the emulator side.
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 ACTIONto the create table statement.Current Behavior
Wrench adds
ON DELETE NO ACTION, changing the statement syntax.Steps to Reproduce
script 1:
ON DELETE NO ACTIONis being added by wrench. If it wasn't being added by wrench, then second migration would succeed.Context (Environment)
v1.6.0v1.47.0tov1.49.0v1.5.0if 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: GoogleCloudPlatform/cloud-spanner-emulator#142 but I was told the fix should be on the wrench side, not the emulator side.