jbogard / Respawn

Intelligent database cleaner for integration tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Partial delete of a table rows

carl-berg opened this issue · comments

I was wondering if there's been any thought put into being able to control the deletion of table data?

I currently have a case where i would like to keep certain rows in one table between checkpoint resets but I would still like any new rows to be removed. I could handle this by copy-pasting the SqlServerDbAdapter and tweak the BuildDeleteCommandText(GraphBuilder graph) method but it feels a bit clunky. Any thoughts/suggestions on this?

I think this is the most crucial feature to make this library viable if you have complex seed data (which you have in most cases imo).

@jbogard maybe the developer could provide their own where statement for the delete for each table? You could then ignore your seed data easily by providing something like where Id > 10. Or it could be generated automatically by running it against the DB. Not sure if it would be faster than the snapshot restore though.

How was this completed? I see no documentation on how to do this

Fixed the close reason. I didn't know GH bulk-close would assign a reason (and also not let me choose a reason).