CodeIgniter: DBFORGE error using default CURRENT_TIMESTAMP
When adding a field to DBFORGE with type “timestamp” and default “CURRENT_TIMESTAMP” it renders a query:
time
timestamp NOT NULL DEFAULT ‘CURRENT_TIMESTAMP’ COMMENT ‘’
However, this should be a special case, and render: (no single quotes)
time
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘’
This matters for migrations. When writing a migration, this is necessary if you have a timestamp column. Note: I don’t know what is the case for “datetime” columns
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 18 (6 by maintainers)
Commits related to this issue
- Add support for CURRENT_TIMESTAMP (and similar) defaults to date/time fields in DB Forge As requested in #4852 — committed to bcit-ci/CodeIgniter by narfbg 8 years ago
This has been added to the 3.2 milestone which has not be released since 3 years
The code in quesion is very simple … I shouldn’t have to answer this.
That’s a work-around, not a fix … And we already do have a work-around - you could simply pass the entire SQL field definition as a string.