Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(coderd/database): generate foreign key constraints and add database.IsForeignKeyViolation#9657

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 2 commits intomainfromcj/dbgen-fk-constraints
Sep 13, 2023

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedSep 13, 2023
edited
Loading

I saw that we were generating this for unique constraints and thought it might be useful to add it for foreign keys as well (to be used in a follow-up PR)

@johnstcnjohnstcn self-assigned thisSep 13, 2023
@johnstcnjohnstcn changed the titlefeat(coderd/database): generate foreign key constraints, add database.IsForeignKeyViolationfeat(coderd/database): generate foreign key constraints and add database.IsForeignKeyViolationSep 13, 2023
@johnstcnjohnstcn marked this pull request as ready for reviewSeptember 13, 2023 10:20
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

note: I haven't performed any DRY refactoring on this piece here; I figure de-duplication is premature.

Copy link
Member

Choose a reason for hiding this comment

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

💯 agreed.

Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

(to be used in a follow-up PR)

👍

name:=""
switch {
casestrings.Contains(query,"ALTER TABLE")&&strings.Contains(query,"ADD CONSTRAINT"):
name=strings.Split(query," ")[6]
Copy link
Contributor

Choose a reason for hiding this comment

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

parsing is pretty flimsy, but I guess the rest of the file is no better...

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah... it works for the moment.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's worth improving, SQL is pretty stable 😄.

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Thanks for adding this! ❤️

@johnstcnjohnstcn merged commit2ac5329 intomainSep 13, 2023
@johnstcnjohnstcn deleted the cj/dbgen-fk-constraints branchSeptember 13, 2023 12:28
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 13, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@mafredrimafredrimafredri approved these changes

@spikecurtisspikecurtisspikecurtis left review comments

@mtojekmtojekmtojek approved these changes

Assignees

@johnstcnjohnstcn

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@johnstcn@mafredri@spikecurtis@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp