Skip to content

Commit

Permalink
backend: Add migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
phlmn committed Jan 17, 2025
1 parent b2e44db commit b0dc59b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ notebooks = [
"seaborn~=0.12.2",
]

[project.scripts]
transcribee-migrate = "transcribee_backend.db.run_migrations:main"

[tool.uv]
override-dependencies = [
"sqlalchemy==1.4.41"
Expand All @@ -67,7 +70,7 @@ test = "pytest tests/"
pyright = "pyright transcribee_backend/"

[tool.setuptools]
packages = ["transcribee_backend"]
packages = ["transcribee_backend", "transcribee_backend.db"]

[build-system]
requires = ["setuptools", "setuptools-scm"]
Expand Down
19 changes: 19 additions & 0 deletions backend/transcribee_backend/db/run_migrations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python

from os import path

from alembic import command
from alembic.config import Config


def main():
alembic_cfg = Config()
alembic_cfg.set_main_option(
"script_location",
path.join(path.dirname(path.realpath(__file__)), "migrations"),
)
command.upgrade(alembic_cfg, "head")


if __name__ == "__main__":
main()

0 comments on commit b0dc59b

Please sign in to comment.