You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a @UpdateDateColumn() and I generated a new Migration with this change. I think it should generate an ON UPDATE clause in the query to create this column. For example, a good result would be
awaitqueryRunner.query("ALTER TABLE `operation` ADD `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)");
Actual Behavior
The generated migration for the @UpdateDateColumn() is the same as the @CreateDateColumn(). However, I don't think it's good.
For example, here is the generated code in the up() method to create the @CreateDateColumn() and the @UpdateDateColumn():
awaitqueryRunner.query("ALTER TABLE `operation` ADD `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)");awaitqueryRunner.query("ALTER TABLE `operation` ADD `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)");
jafio
changed the title
Generating migrations for UpdateDateColumn should generate on update close
Generating migrations for UpdateDateColumn should generate on update clause
Nov 11, 2020
Issue Description
Expected Behavior
I added a
@UpdateDateColumn()
and I generated a new Migration with this change. I think it should generate anON UPDATE
clause in the query to create this column. For example, a good result would beActual Behavior
The generated migration for the
@UpdateDateColumn()
is the same as the@CreateDateColumn()
. However, I don't think it's good.For example, here is the generated code in the
up()
method to create the@CreateDateColumn()
and the@UpdateDateColumn()
:Steps to Reproduce
up()
method of the created migration, you should see the problem.My Environment
Relevant Database Driver(s)
aurora-data-api
aurora-data-api-pg
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: