Storing extra information in alembic_version
table
#1075
darraghenright
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
yes there's a long-standing issue for this at #309. however your suggestion to also include the message is a handy one. as mentioned in that issue someone has implemented https://github.com/jpassaro/Audit-Alembic but I haven't evaluated this at all. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there 👋
I am guessing this is a topic that might have come up before, if so I am mostly curious about what the general sentiment is, more than this being an actual suggestion!
The
alembic_version
table records each revision reference that was run. I have a requirement to record some supporting information including:inserted_at
datetime to show when the migration was run in the database.alembic revision -m hello
.The use case here is to allow the ability for someone to view the table and get an idea of what happened and when. This can be useful for people who don't have access to the migrations files.
I am new to Alembic and I was curious to know if it was possible to configure the library to achieve either of these requirements. I dug into the code and found where the table is created which confirms that it's not possible to do so.
Implementing the
inserted_at
datetime can be easily implemented outside of the scope of the application of course, by using a trigger.The second requirement, not so much. I guess this would assume that the information is retrievable from the migration file itself, which is technically possible by adding
message = ${repr(message)}
or just using the multiline comment at the top of the file. Of course, there's no guarantee that these are usable because the template can be customised.Anyway, just curious about this and figured it'd be worth discussing. Thanks! 😃
Beta Was this translation helpful? Give feedback.
All reactions