How to link an event DDL with a migration? #1549
Replies: 1 comment 5 replies
-
There's multiple levels of "why?" to this question. so here are those:
as far as it being autogenerated directly into the migration file, not really, you'd need to write custom render functions to do that.
I wouldnt use events inside a migration file, I'd have code that calls either the DDL() operation directly using
if you want a certain thing to happen for all create table operations, I'd use the event but it would be defined at the
the actual modify here looks like what SQLAlchemy does already for an integer primary key column under MySQL, and it's not stated here what you are changing it from. if this is for the datatype you could more easily use with_variant in your model (autogen should render that also). overall I would need more context to advise on the best way to solve your issue |
Beta Was this translation helpful? Give feedback.
-
What is the right way to set an SQLAlchemy custom event DDL so that it would be added to the autogenerated migration file?
For example:
The query doesn't appear automatically with the
alembic revision --autogenerate
command.My current solution is to manually copy this DDL to the migration. Is there a better, automatic way?
P. S. I found this SO question, but I could not make it work with the proposed answers.
Beta Was this translation helpful? Give feedback.
All reactions