Unfortunately, ON UPDATE current_timestamp doesn't seem to be supported by SQLite.
While for creating a table the test following case passes, I don't think it has any effect:
$this->assertQuery(
'CREATE TABLE _tmp_table (
id int(11) NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);'
);
For altering a table, the following test case fails with SQLSTATE[HY000]: General error: 1 near "ON": syntax error.:
$this->assertQuery(
'CREATE TABLE _tmp_table (
id int(11) NOT NULL
);'
);
$this->assertQuery(
'ALTER TABLE _tmp_table ADD COLUMN created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
);
I think the only way to support this would be to create a trigger, but I suppose it would also need to be removed before any other ALTER TABLE statement for the same column, as if the statement omits the ON UPDATE part, it would need to be removed.
Unfortunately,
ON UPDATE current_timestamp
doesn't seem to be supported by SQLite.While for creating a table the test following case passes, I don't think it has any effect:
For altering a table, the following test case fails with
SQLSTATE[HY000]: General error: 1 near "ON": syntax error.
:I think the only way to support this would be to create a trigger, but I suppose it would also need to be removed before any other
ALTER TABLE
statement for the same column, as if the statement omits theON UPDATE
part, it would need to be removed.