Skip to content

Commit c3dcec4

Browse files
authored
RDB extra에 Alembic 및 revision ID 생성 로직 추가 (#6)
* Add alembic extra.. * Add revision numbering algorithm..
1 parent 1e7ef5a commit c3dcec4

3 files changed

Lines changed: 138 additions & 11 deletions

File tree

poetry.lock

Lines changed: 129 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pymfdata/rdb/migration.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from datetime import datetime
2+
from typing import List
3+
4+
5+
def process_revision_directives(context, revision, directives: List):
6+
script = directives[0]
7+
script.rev_id = datetime.now().strftime("%y%m%d%H%M%S")

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ packages = [
1111
python = "^3.8"
1212
motor = {version = "2.5.1", optional = true}
1313
SQLAlchemy = {version = "1.4.22", optional = true}
14+
alembic = {version = "^1.7.1", optional = true}
1415

1516
[tool.poetry.dev-dependencies]
1617
pytest = "^6.2.4"
1718

1819
[tool.poetry.extras]
1920
mongodb = ["motor"]
20-
rdb = ["SQLAlchemy"]
21+
rdb = ["alembic", "SQLAlchemy"]
2122

2223
[build-system]
2324
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)