Propose support DDL ON UPDATE #5944

Open
opened 2026-01-22 15:22:45 +01:00 by admin · 1 comment
Owner

Originally created by @ilyar on GitHub (Apr 7, 2018).

/**
 * @Column(
 *     name="update_at",
 *     type="datetime",
 *     options={"default" : "CURRENT_TIMESTAMP"},
 *     onUpdate="CURRENT_TIMESTAMP"
 * )
 */
private $updateAt;
ALTER TABLE app_af_appraisal_form
  ADD update_at DATETIME DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP;

The current working alternative:

/**
 * @Column(
 *     name="update_at",
 *     type="datetime",
 *     columnDefinition="DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
 * )
 */
private $updateAt;

refs:

Originally created by @ilyar on GitHub (Apr 7, 2018). ```php /** * @Column( * name="update_at", * type="datetime", * options={"default" : "CURRENT_TIMESTAMP"}, * onUpdate="CURRENT_TIMESTAMP" * ) */ private $updateAt; ``` ```sql ALTER TABLE app_af_appraisal_form ADD update_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ``` The current working alternative: ```php /** * @Column( * name="update_at", * type="datetime", * columnDefinition="DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" * ) */ private $updateAt; ``` refs: * MySQL: https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html * PostgreSQL (via trigger): https://www.postgresql.org/message-id/20060123143134.GH18894%40webserv.wug-glas.de
Author
Owner

@Ocramius commented on GitHub (Apr 7, 2018):

"ON UPDATE" support was removed in doctrine/orm a few years back, as the
ORM cannot handle identifier changes.

It shouldn't be re-introduced unless a very strong and common use-case is
presented.

On Sat, 7 Apr 2018, 14:40 Ilya Rogov, notifications@github.com wrote:

/** * @Column( * name="update_at", * type="datetime", * options={"default" : "CURRENT_TIMESTAMP"}, * onUpdate="CURRENT_TIMESTAMP" * ) */private $updateAt;

ALTER TABLE app_af_appraisal_form
ADD update_at DATETIME DEFAULT CURRENT_TIMESTAMPON UPDATE CURRENT_TIMESTAMP;

The current working alternative:

/** * @Column( * name="update_at", * type="datetime", * columnDefinition="DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" * ) */private $updateAt;

refs:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7178, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakOx8R5c791fxJBI22qUTPZtWB1aDks5tmLO4gaJpZM4TLEJF
.

@Ocramius commented on GitHub (Apr 7, 2018): "ON UPDATE" support was removed in doctrine/orm a few years back, as the ORM cannot handle identifier changes. It shouldn't be re-introduced unless a very strong and common use-case is presented. On Sat, 7 Apr 2018, 14:40 Ilya Rogov, <notifications@github.com> wrote: > /** * @Column( * name="update_at", * type="datetime", * options={"default" : "CURRENT_TIMESTAMP"}, * onUpdate="CURRENT_TIMESTAMP" * ) */private $updateAt; > > ALTER TABLE app_af_appraisal_form > ADD update_at DATETIME DEFAULT CURRENT_TIMESTAMPON UPDATE CURRENT_TIMESTAMP; > > The current working alternative: > > /** * @Column( * name="update_at", * type="datetime", * columnDefinition="DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" * ) */private $updateAt; > > refs: > > - MySQL: > https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html > - PostgreSQL (via trigger): > https://www.postgresql.org/message-id/20060123143134.GH18894%40webserv.wug-glas.de > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/7178>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakOx8R5c791fxJBI22qUTPZtWB1aDks5tmLO4gaJpZM4TLEJF> > . >
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5944