tortoise / aerich

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

No changes detected #119

Closed facundopadilla closed 3 years ago

facundopadilla commented 3 years ago

I am separating the models in different files, on the right you can see the script "settings.py" that allows me to load the modules where I have the models, when I do an "init-db" it works without problems, the other commands work but when I want to do the migrations, it says that it does not detect changes, I am seeing that some people are having the same problem, previously I got an error like this: "old_model does not have the method/attribute 'pop'", (I forgot to take the capture and did a "clear" unconsciously).

I'm using FastAPI, Aerich, TortoiseORM and Dynaconf.

image

facundopadilla commented 3 years ago

image

facundopadilla commented 3 years ago

image

facundopadilla commented 3 years ago

Before to execute: uvicorn main:application --reload

image

long2ice commented 3 years ago

Did you use latest version?

facundopadilla commented 3 years ago

Did you use latest version?

aerich==0.5.0 aiosqlite==0.16.1 asyncpg==0.21.0 click==7.1.2 ddlparse==1.9.0 dictdiffer==0.8.1 dnspython==2.1.0 dynaconf==3.1.2 email-validator==1.1.2 fastapi==0.63.0 h11==0.12.0 idna==3.1 iso8601==0.1.14 loguru==0.5.3 passlib==1.7.4 pydantic==1.7.3 pyparsing==2.4.7 PyPika==0.44.1 python-multipart==0.0.5 pytz==2020.5 six==1.15.0 starlette==0.13.6 tortoise-orm==0.16.21 typing-extensions==3.7.4.3 uvicorn==0.13.3

long2ice commented 3 years ago

If you upgrade with old version, you should drop aerich table in database, and remove models directory, then rerun init-db.

facundopadilla commented 3 years ago

If you upgrade with old version, you should drop aerich table in database, and remove models directory, then rerun init-db.

I just did it and now I see this

image

metakot commented 3 years ago

I think aerich just dropped PostgreSQL support. Whenever I change CharField to another length, the migrate command generates migration file with CHANGE field field VARCHAR(256) but the PostgreSQL needs ALTER COLUMN field TYPE VARCHAR(256). And if I change null=False to null=True it outputs No changes detected.

long2ice commented 3 years ago

Which is bug and will be fix later.

long2ice commented 3 years ago

Fixed in https://github.com/tortoise/aerich/commit/52151270e0491a8436461cdba94ff76678f0d986, just install from latest dev branch and try.

vadim-shadrin commented 3 years ago

I guess you fogot import model in init.py

alexanderankin commented 4 months ago

can we re-open this issue again? seems like a persistent one