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

table constraints #114

Merged
merged 2 commits into from
Sep 21, 2017
Merged

table constraints #114

merged 2 commits into from
Sep 21, 2017

Conversation

dolezel
Copy link
Contributor

@dolezel dolezel commented Sep 18, 2017

No description provided.

Copy link

@roman-kaspar roman-kaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

const {
columns,
} = fk;
constraints.push(`FOREIGN KEY "${_.isArray(columns) ? columns.join('", "') : columns}" ${parseReferences(fk)}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is producing incorrect SQL for me when I try to specify a compound foreign key. When I write

{
  constraints: {
    foreignKeys: [
      {
        columns: [ "columnA", "columnB" ],
        references: "otherTable (A, B)"
      }
  }

I expect to get FOREIGN KEY (columnA, columnB) REFERENCES otherTable (A, B) but instead I get FOREIGN KEY "columnA, columnB" REFERENCES otherTable (A, B), which is not correct.

@dolezel
Copy link
Contributor Author

dolezel commented Sep 25, 2017

Sorry, I forgot about parenthesis

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

Successfully merging this pull request may close these issues.

3 participants