Fork me on GitHub
Subscribe 2

Ticket #536 (fixed bug)

Default value for table column

  • Created: 2011-11-10 06:53:47
  • Reported by: daris
  • Assigned to: Franz
  • Milestone: 2.0-alpha1
  • Component: database
  • Priority: normal

Setting '' as default value for column should assign a '' (empty string) value instead of null

For example:

$query->field('search_for', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(60), '', false);


`search_for` varchar(60) NOT NULL DEFAULT NULL,

instead of:

`search_for` varchar(60) NOT NULL DEFAULT '',

Also, setting 0 as a default value (without quotes), sets the null for the column (when it should be 0). It's not the new dblayer issue, but it's a PDO related problem. Is it worth doing a workaround for this?

Franz wrote:

also: we should definitely not require the coder to call $db->quote() on a default value that he passes to that query class.


daris 2011-11-10 06:54:42

  • Description changed. (Diff)

Franz 2011-11-17 23:38:06

I've almost got this, just struggling with PostgreSQL at the moment. Once I'm done and have it pushed, can you update the install script this once more? smile

Franz 2011-11-18 00:00:49

Commit 742f3a2 to database master

Fix column default values. Not yet done for PostgreSQL.
Related to #536.

daris 2011-11-18 07:19:11

I can, no problem smile

Franz 2011-11-23 00:40:47

  • Status changed from open to fixed.

Should be done now. Even the default values that the tableInfo() function spits out, are quite nice.