Open dmto0l2022 opened 1 year ago
Same issue
Did you get any solution?
Did you run aerich init first?
Did you run aerich init first?
Also: Do you already have a migrations/models folder present? if so, try delete it and repeat
Thanks for update
Describe the bug Unable to run aerich init-db
To Reproduce see https://github.com/dmto0l2022/basecode/tree/main/fastapi_aerich I am using aerich for migrations within a podman container
Expected behavior aerich init-db should run and the following error should not arise:
Inited models already, or delete migrations/models and try again. Traceback (most recent call last): File "/env/bin/aerich", line 8, in
sys.exit(main())
^^^^^^
File "/env/lib/python3.11/site-packages/aerich/cli.py", line 265, in main
cli()
File "/env/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/aerich/cli.py", line 34, in wrapper
loop.run_until_complete(Tortoise.close_connections())
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/tortoise/init.py", line 615, in close_connections
await connections.close_all()
File "/env/lib/python3.11/site-packages/tortoise/connection.py", line 188, in close_all
tasks = [conn.close() for conn in self.all()]
^^^^^^^^^^
File "/env/lib/python3.11/site-packages/tortoise/connection.py", line 177, in all
return [self.get(alias) for alias in self.db_config]
^^^^^^^^^^^^^^
File "/env/lib/python3.11/site-packages/tortoise/connection.py", line 48, in db_config
raise ConfigurationError(
tortoise.exceptions.ConfigurationError: DB configuration not initialised. Make sure to call Tortoise.init with a valid configuration before attempting to create connections.
Additional context Sadly I have moved across to SQLModel and have been able to get migrations to work successfully.