Skip to content

Add support for custom delete statements#137

Merged
jbogard merged 1 commit intojbogard:masterfrom
cervengoc:master
Mar 7, 2025
Merged

Add support for custom delete statements#137
jbogard merged 1 commit intojbogard:masterfrom
cervengoc:master

Conversation

@cervengoc
Copy link

Added an extension point to allow customizing generated delete statements. This might be used for adding conditions, etc.
This can open some solution paths for #122 and #126 as well.

@cervengoc
Copy link
Author

@jbogard Please point me to the right direction, is this technically enough, or should I for example

  • Add tests for all database providers?
  • Add some documentation somewhere?

Thank you

@jbogard
Copy link
Owner

jbogard commented May 20, 2024

Interesting idea, seems useful!

@cervengoc
Copy link
Author

cervengoc commented Jun 3, 2024

@jbogard sorry for pinging you.

In the meantime I've examined that these kind of customizations are already possible via implementing a custom IDbAdapter and passing that in with the config. A simple implementation could be for example by decorating an existing provider and modifying the generated SQL text line by line. However, that's definitely a bit harder, but taking the rarity of the use-cases into account, it still might be enough so I probably would rather abandon this PR. What do you think? On the other hand, is IDbAdapter ment to be part of the public API of this tool, or is it ment to be internal? Because if the latter, than it might not be adviced to use it like that.

@alesdvorakcz
Copy link

alesdvorakcz commented Jul 11, 2024

I like this idea, it would be helpful for me. Decorating an IDbAdapter does not work for me because it is internal class.

My use case: I have some data added to a table by EF migration and I want to keep them so I dont need to run migrations again

EDIT: My mistake, I found out how to decorate IDbAdapter, I can access its instance from static class DbAdapter. Its still not really user friendly.

@jbogard jbogard merged commit 8b05de7 into jbogard:master Mar 7, 2025
0xced added a commit to 0xced/Respawn that referenced this pull request Mar 9, 2025
This bug arose from merging both jbogard#137 and jbogard#151

jbogard#137 introduced a new `RespawnerOptions` property and jbogard#151 introduced a mechanism that copies all the `RespawnerOptions` properties.
github-merge-queue bot pushed a commit to DFE-Digital/teaching-record-system that referenced this pull request Jan 29, 2026
Updated [Respawn](https://github.com/jbogard/Respawn) from 6.2.1 to
7.0.0.

<details>
<summary>Release notes</summary>

_Sourced from [Respawn's
releases](https://github.com/jbogard/Respawn/releases)._

## 7.0.0

## What's Changed
* Bump Npgsql from 6.0.2 to 8.0.3 in /Respawn.DatabaseTests by
@​dependabot[bot] in jbogard/Respawn#138
* Update Microsoft.Data.SqlClient to 5.1.4 to address CVE-2023-36414 by
@​jellebuitenhuisis in jbogard/Respawn#142
* Add support for custom delete statements by @​cervengoc in
jbogard/Respawn#137
* Add ConfigureAwait(false) to async method calls, to prevent potential…
by @​Insire in jbogard/Respawn#136
* support database names containing special characters by @​alexmo16 in
jbogard/Respawn#144
* SqlServer reseed fix for objects with special character in name by
@​flarestudiopl in jbogard/Respawn#149
* Add IBM DB2 support by @​MD-V in
jbogard/Respawn#145
* Remove the `Microsoft.Data.SqlClient` dependency by @​0xced in
jbogard/Respawn#153
* Infer the DbAdapter from the DbConnection by @​0xced in
jbogard/Respawn#151
* Added an IDbAdapter for Snowflake by @​SaiSDET in
jbogard/Respawn#154
* Fix FormatDeleteStatement being ignored by @​0xced in
jbogard/Respawn#155
* Add Sqlite support with SqliteDbAdapter implementation by
@​snowfrogdev in jbogard/Respawn#156
* Fixing build by @​jbogard in
jbogard/Respawn#160
* Removing docker compose; .NET 10 tests by @​jbogard in
jbogard/Respawn#161

## New Contributors
* @​jellebuitenhuisis made their first contribution in
jbogard/Respawn#142
* @​cervengoc made their first contribution in
jbogard/Respawn#137
* @​Insire made their first contribution in
jbogard/Respawn#136
* @​alexmo16 made their first contribution in
jbogard/Respawn#144
* @​flarestudiopl made their first contribution in
jbogard/Respawn#149
* @​MD-V made their first contribution in
jbogard/Respawn#145
* @​0xced made their first contribution in
jbogard/Respawn#153
* @​SaiSDET made their first contribution in
jbogard/Respawn#154
* @​snowfrogdev made their first contribution in
jbogard/Respawn#156

**Full Changelog**:
jbogard/Respawn@v6.2.1...v7.0.0

Commits viewable in [compare
view](jbogard/Respawn@v6.2.1...v7.0.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Respawn&package-manager=nuget&previous-version=6.2.1&new-version=7.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Gunn <[email protected]>
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