[FEATURE] Table to ignore#6
Conversation
|
Strangely, I actually prefer your first PR as it means there's only one high level instantiation of the |
|
The reason is that I'm working on expanding that feature allowing also to ignore fields of certain tables with a YAML config like: To achieve this I need the params in the method Btw, I found an even better solution IMHO that is to make static the method I updated the commit adding also the possibility to ignore fields. Do you like this approach better? |
|
This is fantastic work! And the ability to ignore fields on tables is something I think users of DBDiff would really appreciate! I'll merge this in as it is :) |
MySQLAdapter::getTables() now uses SHOW FULL TABLES WHERE Table_type = 'BASE TABLE' instead of SHOW TABLES, preventing views from entering the diff pipeline and being incorrectly handled as tables (which would generate DROP TABLE instead of DROP VIEW). PostgreSQL and SQLite adapters were already correct — pg_tables only includes base tables and SQLite filters type = 'table'. Added unit tests for DropTableSQL and AddTableSQL output verification. Refs: bugs.md Bug #6, PR #123
Bug #3 — Hyphenated database names (End2EndTest::testHyphenatedDatabaseNames) Runs the full MySQL end-to-end diff with databases named 'diff-1'/'diff-2'. Before the fix, unquoted hyphens caused MySQL error 1064. The test asserts that DBDiff completes, writes output, and that output matches the standard baseline (same schema/data, only the DB name differs). Bug #6 — Views excluded from diff (AbstractComprehensiveTest::testViewsExcludedFromDiff) New fixture 'views_ignored': source DB has a TABLE 'products' + VIEW 'active_products'; target DB has only the table with an extra column. Test asserts 'active_products' never appears in the diff output, while the real schema difference (price column) is still detected. Fixture files added for MySQL, PostgreSQL, and SQLite. Bug #7 — NULL column changes detected (AbstractComprehensiveTest::testNullableColumnDataDetected) New fixture 'nullable_data': rows 1 and 2 have NULL<->value changes in a nullable column; row 3 has NULL in both source and target (must be ignored). Test asserts UPDATE statements are generated and row 3 is absent. Fixture files added for MySQL, PostgreSQL, and SQLite.
Tables to ignore from the check can be set in the .dbdiff config file with a YAML collection: