mirror of
https://github.com/a-mayb3/Kanban_clone_backend.git
synced 2026-03-21 10:05:38 +01:00
Started implementing auth
This commit is contained in:
parent
e557c25789
commit
b909a23fa3
7 changed files with 279 additions and 19 deletions
11
database.py
11
database.py
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
import sqlalchemy
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
|
@ -8,16 +10,17 @@ from fastapi import Depends
|
|||
from sqlalchemy.orm import Session
|
||||
from typing import Annotated
|
||||
|
||||
|
||||
|
||||
URL_DATABASE = "sqlite:///./kanban_clone.db"
|
||||
|
||||
engine = create_engine(URL_DATABASE)
|
||||
engine = create_engine(URL_DATABASE, echo=True)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
def init_db() -> None:
|
||||
# Import models so they are registered with SQLAlchemy metadata
|
||||
import models # noqa: F401
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
def get_db():
|
||||
db = SessionLocal()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue