Mysql – Predict MySQL errors when turning on STRICT mode(s)

MySQL

I've got a database which hasn't been very well designed. For example, there are DATETIME fields (not null) which have values like 0000-00-00 00:00:00.

I want to turn on STRICT_TRANS_TABLES mode. The database functions but the apps often fail with broken queries (often INSERT/UDPATE)

Are there any tools to recommend what should be fixed by looking at the data in tables & structure?

Specifically looking for:

  • Built in warnings (if any?)
  • Asking the mysql server if it thinks there is anything wrong with the structure & table data

Best Answer

  • There are few, if any, tools are available.
  • You really must study the code enough to understand it, before thinking about automated fixes.
  • You can probably study each problem in depth and fix it before moving on. For example, changing 0 dates to NULLs is probably an ALTER plus an UPDATE. But then the code needs changing to test for NULL instead of 0.