Update database.py
Browse files- database.py +5 -1
database.py
CHANGED
@@ -10,8 +10,12 @@ DATABASE_URL = "sqlite:///./test.db" # Update this with your database URL
|
|
10 |
|
11 |
engine = create_engine(DATABASE_URL)
|
12 |
|
13 |
-
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
def get_db():
|
16 |
db = SessionLocal()
|
17 |
try:
|
|
|
10 |
|
11 |
engine = create_engine(DATABASE_URL)
|
12 |
|
|
|
13 |
|
14 |
+
# Create the tables defined in your models.
|
15 |
+
Base.metadata.create_all(bind=engine)
|
16 |
+
|
17 |
+
# You can remove the 'SessionLocal' setup if you're using FastAPI's Dependency system.
|
18 |
+
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
19 |
def get_db():
|
20 |
db = SessionLocal()
|
21 |
try:
|