typeorm icon indicating copy to clipboard operation
typeorm copied to clipboard

Migration timestamp in database should be the execution timestamp, not the creation timestamp

Open MaikeMota opened this issue 6 years ago • 7 comments

Issue type: [x] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [x] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[ ] latest [ ] @next [x] 0.2.25

When running a migration, the timestamp in the migration table in the database is inserting the same timestamp as the creation of the file ( the one prepending at the filename). image

Steps to reproduce or a small repository showing the problem:

Run any migration.

Expected behavior When a migration is created, a timestamp is prepended at his filename, this is a good way for preventing filename collision, but this is not the timestamp when the migration is really applied in the database, that still need to be developed and tested, maybe run in different environments before really executes in a production database.

What I expected to see in the timestamp column in the database is exactly when that migration has executed in that database. If I need to track down a bug or some misbehavior, is easier to see if the that migration could be the cause or contribute for that.

MaikeMota avatar Oct 02 '20 06:10 MaikeMota

The timestamp in the column (and file/class) is for determining which migrations have run, which still need to be run, and the order.

Adding an "executed at" column to it (amusingly) would be pretty difficult to do, but it sounds like that's what you're requesting?

imnotjames avatar Oct 02 '20 14:10 imnotjames

Hm... It's look like I had a misunderstanding about the timestamp column in TypeORM migration table...

But, from my previously experience with others ORM, and another languages, the timestamp values from migration collection/table always is the execution date, for historical purpose.

Adding the "executed at" column will provide the information that will be utile to know when the migrations has been executed on the database.

Should I change this issue to a Feature Request?

MaikeMota avatar Oct 02 '20 14:10 MaikeMota

I agree that having an executed_at timestamp could be quite useful (only for historical purposes, not used for anything)

kendallroth avatar Sep 30 '21 17:09 kendallroth

This would be very useful for many projects. +1 :)

Thomas-1985 avatar Jun 07 '22 21:06 Thomas-1985

TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).

As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.

🧹 This issue is being automatically closed because it has had no activity in the last 6 months. If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.

github-actions[bot] avatar Sep 18 '25 15:09 github-actions[bot]

If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.

I think this issue is still relevant.

peterbherman avatar Jun 16 '26 16:06 peterbherman

If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.

I think this issue is still relevant.

I also think this issue is still relevant

cgrafton avatar Jun 16 '26 17:06 cgrafton