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

Feature add foreign key on update on delete trigger config #370

Merged
merged 3 commits into from
Apr 26, 2019

Conversation

HugoPoi
Copy link
Contributor

@HugoPoi HugoPoi commented Dec 4, 2018

Description

Add possibility to configure the foreign key constraint with 2 optional triggers.

  • add onUpdate foreign key settings
  • add onDelete foreign key settings
  • fix a issue, foreign key index try to be deleted on autoupdate
  • fix a issue, index being recreate each migration when declared directly on property

Related issues

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

@slnode
Copy link

slnode commented Dec 4, 2018

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@HugoPoi HugoPoi force-pushed the feature/foreign-key-on-config branch from 08f6788 to 67345bd Compare December 4, 2018 16:03
@jannyHou
Copy link
Contributor

jannyHou commented Dec 4, 2018

@slnode test please

@HugoPoi
Copy link
Contributor Author

HugoPoi commented Dec 7, 2018

I'm not sure but some test in datasource juggler in windows node 6.x failed, is it related with my changes ?

@derdeka
Copy link

derdeka commented Mar 5, 2019

@dhmlau @virkt25 @jannyHou @b-admike
Is this project dead / end of live as no one is reviewing the PR?
This PR solves several bugs in loopback-connector-mysql which prevent me to use loopback at all.

Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

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

@HugoPoi Sorry for the late reply. I left a comment and triggered a new build for CI.

});
rawConstraints.push(match);
}
} while (match != null);
Copy link
Contributor

Choose a reason for hiding this comment

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

the while loop is a little bit risky to me, what if the statement doesn't contain the constraint? Maybe change the logic to stop when reaches the last line of the statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the if statement line 54 in the while protect for no match in the CREATE TABLE, I think the tricky part is when someone rework my code later, because the iteration over the Regex is not obvious. Maybe add some comment before the line 52 to explain the iteration on the multiple match with RegExp object internal pointer.
Or is there a other way to iterate with complex RegExp ?

@jannyHou
Copy link
Contributor

@slnode test please

@dhmlau
Copy link
Member

dhmlau commented Mar 30, 2019

@jannyHou, the CI is all green. Do you think this PR is good to merge? Thanks.

@jannyHou jannyHou force-pushed the feature/foreign-key-on-config branch from 67345bd to 24fe635 Compare April 26, 2019 15:26
@HugoPoi HugoPoi requested a review from emonddr as a code owner April 26, 2019 15:26
@jannyHou
Copy link
Contributor

@slnode test please

Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

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

@HugoPoi Thank you for the contribution 🎉 !!
LGTM. The travis failure is not related to your PR. I will land it when the jenkins tests pass.

@jannyHou jannyHou merged commit 6218665 into loopbackio:master Apr 26, 2019
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.

5 participants