Search code examples
mysqlsqlormschemapropel

Propel "ON UPDATE" inside schema.xml


I'm attempting to insert the option "ON UPDATE CURRENT_TIMESTAMP" inside column of my schema.xml on PROPEL ORM.

Suppose my schema.xml contains

<column name="modified" phpName="Modified" type="TIMESTAMP" defaultExpr="CURRENT_TIMESTAMP" required="true"/>

I would like to add the "ON UPDATE" SQL statement for this column.

Actually my trick is run

propel diff

Insert "ON UPDATE" inside the generated-migration, obtaining

CHANGE `modified` `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

and at the end

propel migrate

to make effective all changes.

There's a manner to insert this specification inside the "column" Tag, as done for "defaultExpr..." ?


Solution

  • You can just add:

    <column name="modified" phpName="Modified" type="TIMESTAMP" defaultExpr="CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" required="true"/>