[GH-ISSUE #25] Prevent drop table #152

Open
opened 2026-03-07 20:41:36 +03:00 by kerem · 4 comments
Owner

Originally created by @CodingPeak on GitHub (Aug 24, 2016).
Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/25

Is there a way to prevent drop table and drop column in the output?

Originally created by @CodingPeak on GitHub (Aug 24, 2016). Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/25 Is there a way to prevent drop table and drop `column` in the output?
Author
Owner

@jasdeepkhalsa commented on GitHub (Aug 24, 2016):

You can just use the tablesToIgnore: and/or fieldsToIgnore: options in your .dbdiff file: https://github.com/DBDiff/DBDiff#dbdiff to ignore tables and fields which don't exist in the other database. Otherwise you cannot prevent table and column drops as this is a diff-ing algorithm meant to make both databases the same.

<!-- gh-comment-id:242074906 --> @jasdeepkhalsa commented on GitHub (Aug 24, 2016): You can just use the `tablesToIgnore:` and/or `fieldsToIgnore:` options in your `.dbdiff` file: https://github.com/DBDiff/DBDiff#dbdiff to ignore tables and fields which don't exist in the other database. Otherwise you cannot prevent table and column drops as this is a diff-ing algorithm meant to make both databases the same.
Author
Owner

@CodingPeak commented on GitHub (Aug 24, 2016):

I understand. But I'd really need to be able to add tables and columns without losing existing tables and columns and their data. A column name change for example, deletes and creates this column, deleting all column data with it.

<!-- gh-comment-id:242075909 --> @CodingPeak commented on GitHub (Aug 24, 2016): I understand. But I'd really need to be able to add tables and columns without losing existing tables and columns and their data. A column name change for example, deletes and creates this column, deleting all column data with it.
Author
Owner

@jasdeepkhalsa commented on GitHub (Aug 24, 2016):

If there was a way we could detect two columns are the same, then we may be able to do a less harsh operation like delete and re-create - unfortunately I don't think such a way exists.

You may wish to manually write the migration just for the column name update and then let DBDiff do its magic with the rest of the data diff

<!-- gh-comment-id:242101940 --> @jasdeepkhalsa commented on GitHub (Aug 24, 2016): If there was a way we could detect two columns are the same, then we may be able to do a less harsh operation like delete and re-create - unfortunately I don't think such a way exists. You may wish to manually write the migration just for the column name update and then let DBDiff do its magic with the rest of the data diff
Author
Owner

@jasdeepkhalsa commented on GitHub (Aug 25, 2016):

In the future we could introduce here, the ability to skip particular tests on particular tables perhaps?

<!-- gh-comment-id:242386393 --> @jasdeepkhalsa commented on GitHub (Aug 25, 2016): In the future we could introduce here, the ability to skip particular tests on particular tables perhaps?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/DBDiff#152
No description provided.