Jump to content

DB column default value problem while writing an App


Recommended Posts

Hello. Im migrating my app from IPB 3.4 to 4 and i achieved a problem.
My old database has few tables without default values. Of course it's working like a charm for years (integers are always 0 etc..)
But after i migrated some tables, there is a problem with IPS.


I have a knowledge about mysql-server strict mode. I have disabled it but IPS is handling it own way..
I dont want to set manually default values to my own 30 tables - so this is not a solution.

There is one solution "INSERT IGNORE INTO" instead of "INSERT INTO" - it's working, but i don't know it is secure


Link to comment
Share on other sites

We force strict mode enabled when IN_DEV is enabled. The idea being that if you are developing something that may be installed in another environment, it may have strict mode enabled and you should be developing so that things work in this case.

You should either be (1) defining a default value at the table definition level or (2) inserting a value when you insert into the table. You really don't have any other choice, and that's not specific to our software. INSERT IGNORE is not a real solution.

Personally, if you aren't intending to define default values at the code level when inserting, I would just edit the table definition to set a default value (NULL or 0 depending upon your use cases here for an integer field).

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...