feat: add Alembic for database migrations

Replace inline migration logic with proper Alembic migrations:
- 001: Initial schema (creates memories table with FTS)
- 002: Add multi-user and secrets columns (user_id, is_sensitive,
  vault_path, encrypted_content)

Migrations run automatically on app startup. Existing databases
are handled gracefully with IF NOT EXISTS / column existence checks.
This commit is contained in:
Viktor Barzin 2026-03-14 10:34:45 +00:00
parent 63205dbd0c
commit 8a7239fb77
No known key found for this signature in database
GPG key ID: 0EB088298288D958
8 changed files with 244 additions and 58 deletions

36
alembic.ini Normal file
View file

@ -0,0 +1,36 @@
[alembic]
script_location = migrations
sqlalchemy.url = env:DATABASE_URL
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[logger_sqlalchemy]
level = WARN
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