Table to track applied migrations?

18 views
Skip to first unread message

Jasen Jacobsen

unread,
Aug 19, 2020, 11:25:24 AM8/19/20
to sqlalchemy
I've used Liquibase in the past and as part of its migration tracking it creates a table which lists each migration applied. See Liquibase Changelog Table.
Alembic has the alembic_version table, but it only holds a single row and column (version_num).
Is there a way to have Alembic populate a table similarly to Liquibase? (And not manually adding statements to each migration script.) Something that would grab the 'slug', Create Date, Revision ID, and applied date for each migration script and add a row to a table. Maybe something to be used in configure(on_version_apply)?

Thanks for any pointers.

Mike Bayer

unread,
Aug 19, 2020, 1:55:45 PM8/19/20
to noreply-spamdigest via sqlalchemy
this is issue 309 https://github.com/sqlalchemy/alembic/issues/309  waiting for someone with the time and motivation to work on it.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

Jasen Jacobsen

unread,
Aug 19, 2020, 4:20:51 PM8/19/20
to sqlalchemy
Audit-Alembic meets the requirement. It creates an alembic_version_history table, and populates it with Alembic events. Unfortunately, it was last updated three years ago and I believe is out of date (it's check for whether 'on_version_apply' exists fails). And I can't figure out how to get access to the message/slug from within env.py. But it does work in the trivial case.
Reply all
Reply to author
Forward
0 new messages