Skip to content

Commit 0cf58dd

Browse files
committed
Added Alembic setup for database migrations
1 parent eb2b134 commit 0cf58dd

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

alembic/env.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
DATABASE_URL = os.getenv("DATABASE_URL")
1212
config.set_main_option("sqlalchemy.url", DATABASE_URL)
1313

14-
from app.db import Base
15-
from app.models import *
16-
target_metadata = Base.metadata
14+
from app.db.db import Base
15+
import app.db.models
16+
17+
target_metadata = [Base.metadata]
18+
fileConfig(config.config_file_name)
19+
1720
# this is the Alembic Config object, which provides
1821
# access to the values within the .ini file in use.
1922
config = context.config

app/db/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Track(Base):
1515
id = Column(Integer, primary_key=True, index=True)
1616
title = Column(String, unique=True, nullable=False)
1717
description = Column(Text)
18+
testing = Column(Text)
1819

1920
class Task(Base):
2021
__tablename__ = "tasks"

0 commit comments

Comments
 (0)