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

Appearance settings

Fix auto reversing with insert data #1963

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

Merged
merged 7 commits into from
Mar 5, 2025

Conversation

AdrianoRNascimento
Copy link
Contributor

When a table has an FK to itself, the current approach of auto-reverting the inserts fails because it tries to delete rows in the same order they were inserted.

As an example, SQL Server generates this error:

The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "<FK_Name>".

To solve this error, deleting the rows in the inverted order they were inserted is appropriate, exactly as it happens with the expressions.

@jzabroski
Copy link
Collaborator

This looks great. Assuming the build passes I will merge it. Thanks for your patience! Had a few important unexpected family events recently.

@jzabroski jzabroski self-requested a review February 24, 2025 13:53
@jzabroski jzabroski added this to the 7.0.0 milestone Feb 24, 2025
@jzabroski jzabroski added needs:ci-build CI Build Needed. Do not rename this label without updating GH Actions referencing it and removed needs:ci-build CI Build Needed. Do not rename this label without updating GH Actions referencing it labels Feb 24, 2025
@jzabroski jzabroski added needs:ci-build CI Build Needed. Do not rename this label without updating GH Actions referencing it and removed needs:ci-build CI Build Needed. Do not rename this label without updating GH Actions referencing it labels Feb 25, 2025
@jzabroski
Copy link
Collaborator

Apologies while I was sorting out some build pipeline stuff.

It looks like your code has an issue

https://dev.azure.com/fluentmigrator/fluentmigrator/_build/results?buildId=1324&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=86dd5fa6-f51e-57a1-6dd4-575fd75fc7ef

@AdrianoRNascimento
Copy link
Contributor Author

@jzabroski
Thank you.
The build was complaining about the Assert.IsAssignableFrom method.
Just pushed the fix.

@jzabroski
Copy link
Collaborator

@AdrianoRNascimento Your test stub class for auto-reversing broke an unrelated test that was checking to see if we applied all migrations in the assembly - I fixed it and added it to your branch. Re-running the build now and all should pass, then we will merge it. Thanks for your wonderful contribution.

Copy link
Collaborator

@jzabroski jzabroski left a comment

Choose a reason for hiding this comment

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

Address test failure: Foreign keys are not supported in SQLite

@jzabroski jzabroski merged commit ed29279 into fluentmigrator:main Mar 5, 2025
1 check passed
@AdrianoRNascimento
Copy link
Contributor Author

@jzabroski
No problem. I'll try to contribute more often as I use fluentmigrator intensively.
Thank you for the amazing tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:ci-build CI Build Needed. Do not rename this label without updating GH Actions referencing it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.