aerich icon indicating copy to clipboard operation
aerich copied to clipboard

init-db said "Inited models already" even if error has occured before

Open metakot opened this issue 4 years ago • 3 comments

So if I forgot to add "aerich.models" to models config or the importing of the app's models failed because of something, and then run aerich init-db, it failes with error tortoise.exceptions.ConfigurationError: No DB associated to model

Then I made some changes and run the command again, it said Inited models already even if error occured before.

metakot avatar Nov 18 '20 18:11 metakot

just delete migrations/{app} dir, maybe we should catch any exceptions to avoid that.

long2ice avatar Nov 19 '20 01:11 long2ice

Yeah, I think init-db must be atomic or so.

metakot avatar Nov 20 '20 17:11 metakot

just adding to this, neither trying to init again (aerich init-db), migrate (migrate), or upgrading (upgrade) solves the issue. I don't know much about Aerich's codebase, but creating the migrations/models folder only after this step solve the issue?

marcoaaguiar avatar Mar 21 '21 18:03 marcoaaguiar