tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
830 stars 94 forks source link

How to initialize an empty database with existing migrations #267

Closed louison closed 2 years ago

louison commented 2 years ago

I initialized my local database with aerich init -t my_models.TORTOISE_ORM && aerich init-db. It worked perfectly. But I would like to apply the generated migrations to my production database. When I try to apply them with aerich upgrade I get the following error :

tortoise.exceptions.OperationalError: relation "aerich" does not exist

This is expected as the production database is not initialized.

But when I try to initialise it with `aerich init-db' I get the following warning:

Inited models already, or delete migrations/models and try again.

How can I maintain the same migrations and database state between my local (test) database and my production database ?

thx in advance

long2ice commented 2 years ago

Try latest source code, I will release new version if no problem

long2ice commented 2 years ago

Fixed