Open liminspace opened 2 years ago
That'a a good feature, I will consider it
@long2ice I see there is a closed issue #148.
But looks like it was closed mistakenly.
The main idea of that issue was using python code in migrations files, but not executing aerich upgrade
command from python code.
I thinks you should reopen that ticket or join it with current one.
And also look at the fork version of the author and his a proof of concept. It looks good to me.
I'd just add a new command aerich datamigration --name "another_change"
that would be equivalent to cat template.py > migrations/app/"2_$(date +%Y%m%d%H%M%S)_another_change.py"
(from PoC) that creates a new file of data migration using template:
from tortoise.backends.base.client import BaseDBAsyncClient
async def upgrade(conn: BaseDBAsyncClient):
pass
async def downgrade(conn: BaseDBAsyncClient):
pass
Actually, we are trying to migrate from SQLAlchemy and Alembic and we use data migrations very extensively.
Is aerich going to support datamigrations? I mean when you can write your migration logic in python, not only SQL. Django and alembic support them, but aerich not :(