sqlalchemy-bot / test_alembic_1

0 stars 0 forks source link

Record a history of when particular migrations were applied #309

Open sqlalchemy-bot opened 9 years ago

sqlalchemy-bot commented 9 years ago

Migrated issue, originally created by Josh Kupershmidt (schmiddy)

I was a little surprised to see that the alembic_version table records only the current version_num, without even a timestamp indicating when that version was applied. For forensic purposes, it's often handy to know when past migrations were applied to a target database, e.g. when trying to track what happened to a database in the past, determine why some errors popped up in a production database around some time, etc. The alembic history command is useful, but not quite what I'm looking for, since it doesn't tell me when the migrations were actually run in production.

(I'm currently using alembic 0.6.7, but didn't see this feature requested or mentioned anywhere else, so am assuming the situation is the same in the bleeding edge.)

sqlalchemy-bot commented 9 years ago

Michael Bayer (zzzeek) wrote:

not a bad idea but the irony is that while we are all about migrating databases, changing the structure of the alembic_version table itself is tricky. Whether Alembic does it automatically when people upgrade or whether its some kind of option is a decision to be made. or if the structure of alembic_version itself is open ended and there's some kind of extension pattern to use.

sqlalchemy-bot commented 7 years ago

Michael Bayer (zzzeek) wrote:

maybe have this be enabled by a flag, "store_version_history", indicates the alembic_version table will be generated with additional columns up front. then have some other system for people who want to move an existing alembic_version table.

or we have a separate table for history. still might be something we enable w/ a flag though - all the issues, what schema is the table within, what is it named, etc., all that happens again. a separate table at least can show the status of versions that are no longer the current head version.

sqlalchemy-bot commented 6 years ago

Changes by Michael Bayer (zzzeek):