daichirata / hammer

🛠 hammer is a command-line tool to schema management for Google Cloud Spanner.
MIT License
84 stars 25 forks source link

Add support for foreign keys #18

Closed iffyio closed 3 years ago

iffyio commented 3 years ago

Currently hammer ignores foreign keys so that e.g the following detects no diff.

from:

CREATE TABLE T2 (
  ID INT64,
);

to:

CREATE TABLE T2 (
  ID INT64,
  CONSTRAINT FK_T2_ID FOREIGN KEY (ID) REFERENCES T1 (ID)
);

expected:

ALTER TABLE T2 ADD CONSTRAINT FK_T2_ID FOREIGN KEY (ID) REFERENCES T1 (ID)