Database migrations

This commit is contained in:
2026-06-12 07:14:50 -07:00
parent 0535c68647
commit 96eeb442fd
9 changed files with 337 additions and 20 deletions

47
alembic.ini Normal file
View File

@@ -0,0 +1,47 @@
# Dev-only config for the alembic CLI (the app runs migrations itself at
# startup via pirats.database.run_migrations).
#
# New migration: .venv/bin/alembic revision --autogenerate -m "add foo column"
# Apply: .venv/bin/alembic upgrade head
#
# No sqlalchemy.url here: env.py uses the app's engine (DATABASE_URL or
# ./rats_with_gats.db). Override with: alembic -x url=sqlite:///other.db ...
[alembic]
script_location = src/pirats/migrations
file_template = %%(rev)s_%%(slug)s
prepend_sys_path = src
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
handlers = console
qualname =
[logger_sqlalchemy]
level = WARNING
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S