2 Oct 2011 00:30
How to use history_meta.py (VersionedMeta) and migrate together to change schema on both main table and history table?
Jim B. Glenn <jimbglenn <at> gmail.com>
2011-10-01 22:30:43 GMT
2011-10-01 22:30:43 GMT
Does any one have any examples of how to combine sqlalchemy's migrate
to control the database with history from VersionedMeta?
I'm able to use either, but don't really know the best practices for
combining the two.
For example, once I create my table (Equipment) in SQLAlchemy with my
first migrate script using the
Base = declarative_base(metaclass=VersionedMeta)
in my migrate script, what's the best way to add a column to that
table in future migrate scripts?
I was able to add a new column to the Equipment Table in my 2nd
migrate script:
col = Column('newcol',Text, default='foobar')
col.create(Equipment.__table__,populate_default=True)
but it is not reflected in the corresponding equipment_history table
that VersionedMeta created.
What's the best way to combine these 2 technologies to update the
associated _history table from a migration script?
Thanks,
-Jim
--
--
(Continue reading)
RSS Feed