Skip to content
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

ALTER TABLE ADD CONSTRAINT is ignored #4

Open
s13o opened this issue Dec 3, 2020 · 2 comments
Open

ALTER TABLE ADD CONSTRAINT is ignored #4

s13o opened this issue Dec 3, 2020 · 2 comments

Comments

@s13o
Copy link
Contributor

s13o commented Dec 3, 2020

At the export of schema from Spanner web console some FK could be exported by a separate ALTER TABLE instructions like

ALTER TABLE ASSESSMENT ADD CONSTRAINT FK_ASSESSMENT_ACTIVITY FOREIGN KEY(CARE_ACTIVITY_ID) REFERENCES CARE_ACTIVITY(CARE_ACTIVITY_ID);

Such FK-constraints are completely skipped. It is not comfortable. I have to review and manually edit the DDL script to fix it. It could be dozens of such constraints in DDL export.

@nktks
Copy link
Owner

nktks commented Dec 9, 2020

Sorry, this library assumed only create statements.
Because we use only create statements by using https://github.com/daichirata/hammer

@s13o
Copy link
Contributor Author

s13o commented Dec 9, 2020

Oh, really? Thanks, never know such a tool exists. I've used the schema file exported from the spanner web console only and it has a number of "alter" instructions in my case.
I promise you to validate my schema with "Hammer" and will let you know the results. Probably we will close the use then or/and will document a workaround with "Hammer".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants