🚚 — Move alembic.ini in argos directory

This commit is contained in:
Luc Didry 2024-04-10 17:39:52 +02:00
parent fa4de8a2b7
commit 1a44094084
No known key found for this signature in database
GPG key ID: EA868E12D0257E3C
3 changed files with 5 additions and 4 deletions

View file

@ -172,7 +172,8 @@ async def migrate():
settings = get_app_settings() settings = get_app_settings()
alembic_cfg = Config("alembic.ini") current_dir = os.path.dirname(__file__)
alembic_cfg = Config(os.path.join(current_dir, "server/migrations/alembic.ini"))
alembic_cfg.set_main_option("sqlalchemy.url", settings.database_url) alembic_cfg.set_main_option("sqlalchemy.url", settings.database_url)
command.upgrade(alembic_cfg, "head") command.upgrade(alembic_cfg, "head")

View file

@ -1,11 +1,11 @@
[alembic] [alembic]
script_location = alembic script_location = %(here)s
prepend_sys_path = . prepend_sys_path = .
version_path_separator = os version_path_separator = os
sqlalchemy.url = sqlite:////tmp/argos.db sqlalchemy.url = sqlite:////tmp/argos.db
version_locations = %(here)s/argos/server/migrations/versions version_locations = %(here)s/versions
# Logging configuration # Logging configuration
[loggers] [loggers]

View file

@ -7,7 +7,7 @@ First, do your changes in the code, change the model, add new tables, etc. Once
you're done, you can create a new migration. you're done, you can create a new migration.
```bash ```bash
venv/bin/alembic revision --autogenerate -m "migration reason" venv/bin/alembic -c argos/server/migrations/alembic.ini revision --autogenerate -m "migration reason"
``` ```
Edit the created file to remove comments and adapt it to make sure the migration is complete (Alembic is not powerful enough to cover all the corner cases). Edit the created file to remove comments and adapt it to make sure the migration is complete (Alembic is not powerful enough to cover all the corner cases).