Update code via agent code generation
This commit is contained in:
parent
e2134243ae
commit
bd40dcf387
@ -5,4 +5,4 @@ from app.api.v1.endpoints import auth, tasks, users
|
||||
api_router = APIRouter()
|
||||
api_router.include_router(auth.router, prefix="/auth", tags=["auth"])
|
||||
api_router.include_router(users.router, prefix="/users", tags=["users"])
|
||||
api_router.include_router(tasks.router, prefix="/tasks", tags=["tasks"])
|
||||
api_router.include_router(tasks.router, prefix="/tasks", tags=["tasks"])
|
||||
|
@ -21,9 +21,7 @@ async def read_tasks(
|
||||
"""
|
||||
Retrieve tasks.
|
||||
"""
|
||||
tasks = crud.task.get_multi_by_owner(
|
||||
db=db, owner_id=current_user.id, skip=skip, limit=limit
|
||||
)
|
||||
tasks = crud.task.get_multi_by_owner(db=db, owner_id=current_user.id, skip=skip, limit=limit)
|
||||
return tasks
|
||||
|
||||
|
||||
@ -53,9 +51,7 @@ async def read_task(
|
||||
"""
|
||||
task = crud.task.get_by_id_and_owner(db=db, task_id=task_id, owner_id=current_user.id)
|
||||
if not task:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND, detail="Task not found"
|
||||
)
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Task not found")
|
||||
return task
|
||||
|
||||
|
||||
@ -72,9 +68,7 @@ async def update_task(
|
||||
"""
|
||||
task = crud.task.get_by_id_and_owner(db=db, task_id=task_id, owner_id=current_user.id)
|
||||
if not task:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND, detail="Task not found"
|
||||
)
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Task not found")
|
||||
task = crud.task.update(db=db, db_obj=task, obj_in=task_in)
|
||||
return task
|
||||
|
||||
@ -91,8 +85,6 @@ async def delete_task(
|
||||
"""
|
||||
task = crud.task.get_by_id_and_owner(db=db, task_id=task_id, owner_id=current_user.id)
|
||||
if not task:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND, detail="Task not found"
|
||||
)
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Task not found")
|
||||
task = crud.task.remove(db=db, id=task_id)
|
||||
return task
|
||||
return task
|
||||
|
@ -76,4 +76,4 @@ async def read_users(
|
||||
detail="The user doesn't have enough privileges",
|
||||
)
|
||||
users = crud.user.get_multi(db, skip=skip, limit=limit)
|
||||
return users
|
||||
return users
|
||||
|
@ -1,3 +1,3 @@
|
||||
from .settings import settings
|
||||
|
||||
__all__ = ["settings"]
|
||||
__all__ = ["settings"]
|
||||
|
@ -9,20 +9,18 @@ class Settings(BaseSettings):
|
||||
PROJECT_NAME: str = "Task Manager API"
|
||||
DESCRIPTION: str = "API for managing tasks and users"
|
||||
VERSION: str = "0.1.0"
|
||||
|
||||
|
||||
# Security
|
||||
SECRET_KEY: str = os.environ.get("SECRET_KEY", secrets.token_urlsafe(32))
|
||||
# 8 days expiration
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.environ.get("ACCESS_TOKEN_EXPIRE_MINUTES", 60 * 24 * 8))
|
||||
|
||||
|
||||
# Database
|
||||
SQLALCHEMY_DATABASE_URL: str = os.environ.get(
|
||||
"DATABASE_URL", "sqlite:////app/storage/db/db.sqlite"
|
||||
)
|
||||
|
||||
SQLALCHEMY_DATABASE_URL: str = os.environ.get("DATABASE_URL", "sqlite:////app/storage/db/db.sqlite")
|
||||
|
||||
class Config:
|
||||
case_sensitive = True
|
||||
env_file = ".env"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
settings = Settings()
|
||||
|
@ -6,10 +6,4 @@ from .security import (
|
||||
verify_password,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"create_access_token",
|
||||
"verify_password",
|
||||
"get_password_hash",
|
||||
"get_current_user",
|
||||
"get_current_active_user"
|
||||
]
|
||||
__all__ = ["create_access_token", "verify_password", "get_password_hash", "get_current_user", "get_current_active_user"]
|
||||
|
@ -22,15 +22,11 @@ pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl=f"{settings.API_V1_STR}/auth/login")
|
||||
|
||||
|
||||
def create_access_token(
|
||||
subject: Union[str, Any], expires_delta: timedelta = None
|
||||
) -> str:
|
||||
def create_access_token(subject: Union[str, Any], expires_delta: timedelta = None) -> str:
|
||||
if expires_delta:
|
||||
expire = datetime.utcnow() + expires_delta
|
||||
else:
|
||||
expire = datetime.utcnow() + timedelta(
|
||||
minutes=ACCESS_TOKEN_EXPIRE_MINUTES
|
||||
)
|
||||
expire = datetime.utcnow() + timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
|
||||
to_encode = {"exp": expire, "sub": str(subject)}
|
||||
encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
|
||||
return encoded_jwt
|
||||
@ -44,25 +40,22 @@ def get_password_hash(password: str) -> str:
|
||||
return pwd_context.hash(password)
|
||||
|
||||
|
||||
async def get_current_user(
|
||||
db: Session = Depends(get_db), token: str = Depends(oauth2_scheme)
|
||||
) -> User:
|
||||
async def get_current_user(db: Session = Depends(get_db), token: str = Depends(oauth2_scheme)) -> User:
|
||||
credentials_exception = HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Could not validate credentials",
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
try:
|
||||
payload = jwt.decode(
|
||||
token, SECRET_KEY, algorithms=[ALGORITHM]
|
||||
)
|
||||
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
|
||||
token_data = TokenPayload(**payload)
|
||||
if token_data.sub is None:
|
||||
raise credentials_exception
|
||||
except JWTError as e:
|
||||
raise credentials_exception from e
|
||||
|
||||
|
||||
from app.crud import user as user_crud
|
||||
|
||||
user = user_crud.get(db, id=token_data.sub)
|
||||
if user is None:
|
||||
raise credentials_exception
|
||||
@ -74,4 +67,4 @@ async def get_current_active_user(
|
||||
) -> User:
|
||||
if not current_user.is_active:
|
||||
raise HTTPException(status_code=400, detail="Inactive user")
|
||||
return current_user
|
||||
return current_user
|
||||
|
@ -1,4 +1,4 @@
|
||||
from .crud_task import task
|
||||
from .crud_user import user
|
||||
|
||||
__all__ = ["user", "task"]
|
||||
__all__ = ["user", "task"]
|
||||
|
@ -26,9 +26,7 @@ class CRUDBase(Generic[ModelType, CreateSchemaType, UpdateSchemaType]):
|
||||
def get(self, db: Session, id: Any) -> Optional[ModelType]:
|
||||
return db.query(self.model).filter(self.model.id == id).first()
|
||||
|
||||
def get_multi(
|
||||
self, db: Session, *, skip: int = 0, limit: int = 100
|
||||
) -> List[ModelType]:
|
||||
def get_multi(self, db: Session, *, skip: int = 0, limit: int = 100) -> List[ModelType]:
|
||||
return db.query(self.model).offset(skip).limit(limit).all()
|
||||
|
||||
def create(self, db: Session, *, obj_in: CreateSchemaType) -> ModelType:
|
||||
@ -39,13 +37,7 @@ class CRUDBase(Generic[ModelType, CreateSchemaType, UpdateSchemaType]):
|
||||
db.refresh(db_obj)
|
||||
return db_obj
|
||||
|
||||
def update(
|
||||
self,
|
||||
db: Session,
|
||||
*,
|
||||
db_obj: ModelType,
|
||||
obj_in: Union[UpdateSchemaType, Dict[str, Any]]
|
||||
) -> ModelType:
|
||||
def update(self, db: Session, *, db_obj: ModelType, obj_in: Union[UpdateSchemaType, Dict[str, Any]]) -> ModelType:
|
||||
obj_data = jsonable_encoder(db_obj)
|
||||
if isinstance(obj_in, dict):
|
||||
update_data = obj_in
|
||||
@ -63,4 +55,4 @@ class CRUDBase(Generic[ModelType, CreateSchemaType, UpdateSchemaType]):
|
||||
obj = db.query(self.model).get(id)
|
||||
db.delete(obj)
|
||||
db.commit()
|
||||
return obj
|
||||
return obj
|
||||
|
@ -8,20 +8,10 @@ from app.schemas.task import TaskCreate, TaskUpdate
|
||||
|
||||
|
||||
class CRUDTask(CRUDBase[Task, TaskCreate, TaskUpdate]):
|
||||
def get_multi_by_owner(
|
||||
self, db: Session, *, owner_id: int, skip: int = 0, limit: int = 100
|
||||
) -> List[Task]:
|
||||
return (
|
||||
db.query(self.model)
|
||||
.filter(Task.owner_id == owner_id)
|
||||
.offset(skip)
|
||||
.limit(limit)
|
||||
.all()
|
||||
)
|
||||
def get_multi_by_owner(self, db: Session, *, owner_id: int, skip: int = 0, limit: int = 100) -> List[Task]:
|
||||
return db.query(self.model).filter(Task.owner_id == owner_id).offset(skip).limit(limit).all()
|
||||
|
||||
def create_with_owner(
|
||||
self, db: Session, *, obj_in: TaskCreate, owner_id: int
|
||||
) -> Task:
|
||||
def create_with_owner(self, db: Session, *, obj_in: TaskCreate, owner_id: int) -> Task:
|
||||
obj_in_data = obj_in.model_dump()
|
||||
db_obj = self.model(**obj_in_data, owner_id=owner_id)
|
||||
db.add(db_obj)
|
||||
@ -29,14 +19,8 @@ class CRUDTask(CRUDBase[Task, TaskCreate, TaskUpdate]):
|
||||
db.refresh(db_obj)
|
||||
return db_obj
|
||||
|
||||
def get_by_id_and_owner(
|
||||
self, db: Session, *, task_id: int, owner_id: int
|
||||
) -> Optional[Task]:
|
||||
return (
|
||||
db.query(self.model)
|
||||
.filter(Task.id == task_id, Task.owner_id == owner_id)
|
||||
.first()
|
||||
)
|
||||
def get_by_id_and_owner(self, db: Session, *, task_id: int, owner_id: int) -> Optional[Task]:
|
||||
return db.query(self.model).filter(Task.id == task_id, Task.owner_id == owner_id).first()
|
||||
|
||||
|
||||
task = CRUDTask(Task)
|
||||
task = CRUDTask(Task)
|
||||
|
@ -11,7 +11,7 @@ from app.schemas.user import UserCreate, UserUpdate
|
||||
class CRUDUser(CRUDBase[User, UserCreate, UserUpdate]):
|
||||
def get_by_email(self, db: Session, *, email: str) -> Optional[User]:
|
||||
return db.query(User).filter(User.email == email).first()
|
||||
|
||||
|
||||
def get_by_username(self, db: Session, *, username: str) -> Optional[User]:
|
||||
return db.query(User).filter(User.username == username).first()
|
||||
|
||||
@ -28,9 +28,7 @@ class CRUDUser(CRUDBase[User, UserCreate, UserUpdate]):
|
||||
db.refresh(db_obj)
|
||||
return db_obj
|
||||
|
||||
def update(
|
||||
self, db: Session, *, db_obj: User, obj_in: Union[UserUpdate, Dict[str, Any]]
|
||||
) -> User:
|
||||
def update(self, db: Session, *, db_obj: User, obj_in: Union[UserUpdate, Dict[str, Any]]) -> User:
|
||||
if isinstance(obj_in, dict):
|
||||
update_data = obj_in
|
||||
else:
|
||||
@ -56,4 +54,4 @@ class CRUDUser(CRUDBase[User, UserCreate, UserUpdate]):
|
||||
return user.is_superuser
|
||||
|
||||
|
||||
user = CRUDUser(User)
|
||||
user = CRUDUser(User)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
Base = declarative_base()
|
||||
|
@ -8,7 +8,7 @@ class Base:
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
|
||||
@declared_attr
|
||||
def __tablename__(cls) -> str:
|
||||
return cls.__name__.lower()
|
||||
return cls.__name__.lower()
|
||||
|
@ -2,4 +2,4 @@
|
||||
# imported by Alembic
|
||||
from app.db.base import Base # noqa
|
||||
from app.models.user import User # noqa
|
||||
from app.models.task import Task # noqa
|
||||
from app.models.task import Task # noqa
|
||||
|
@ -23,4 +23,4 @@ def init_db(db: Session) -> None:
|
||||
password="adminpassword",
|
||||
is_superuser=True,
|
||||
)
|
||||
crud.user.create(db, obj_in=user_in)
|
||||
crud.user.create(db, obj_in=user_in)
|
||||
|
@ -11,10 +11,7 @@ DB_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
SQLALCHEMY_DATABASE_URL = settings.SQLALCHEMY_DATABASE_URL
|
||||
|
||||
engine = create_engine(
|
||||
SQLALCHEMY_DATABASE_URL,
|
||||
connect_args={"check_same_thread": False}
|
||||
)
|
||||
engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False})
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
|
||||
@ -23,4 +20,4 @@ def get_db():
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
db.close()
|
||||
|
@ -1,4 +1,4 @@
|
||||
from .task import Task
|
||||
from .user import User
|
||||
|
||||
__all__ = ["User", "Task"]
|
||||
__all__ = ["User", "Task"]
|
||||
|
@ -25,9 +25,9 @@ class Task(Base, BaseClass):
|
||||
status = Column(Enum(TaskStatus), default=TaskStatus.TODO, nullable=False)
|
||||
priority = Column(Enum(TaskPriority), default=TaskPriority.MEDIUM, nullable=False)
|
||||
is_completed = Column(Boolean, default=False)
|
||||
|
||||
|
||||
# Foreign key to user
|
||||
owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)
|
||||
|
||||
|
||||
# Relationship with user
|
||||
owner = relationship("User", back_populates="tasks")
|
||||
owner = relationship("User", back_populates="tasks")
|
||||
|
@ -11,6 +11,6 @@ class User(Base, BaseClass):
|
||||
hashed_password = Column(String, nullable=False)
|
||||
is_active = Column(Boolean, default=True)
|
||||
is_superuser = Column(Boolean, default=False)
|
||||
|
||||
|
||||
# Relationship with tasks
|
||||
tasks = relationship("Task", back_populates="owner", cascade="all, delete-orphan")
|
||||
tasks = relationship("Task", back_populates="owner", cascade="all, delete-orphan")
|
||||
|
@ -3,7 +3,14 @@ from .token import Token, TokenPayload
|
||||
from .user import User, UserCreate, UserInDB, UserUpdate
|
||||
|
||||
__all__ = [
|
||||
"User", "UserCreate", "UserUpdate", "UserInDB",
|
||||
"Task", "TaskCreate", "TaskUpdate", "TaskInDB",
|
||||
"Token", "TokenPayload"
|
||||
]
|
||||
"User",
|
||||
"UserCreate",
|
||||
"UserUpdate",
|
||||
"UserInDB",
|
||||
"Task",
|
||||
"TaskCreate",
|
||||
"TaskUpdate",
|
||||
"TaskInDB",
|
||||
"Token",
|
||||
"TokenPayload",
|
||||
]
|
||||
|
@ -46,4 +46,4 @@ class Task(TaskInDBBase):
|
||||
|
||||
# Properties stored in DB
|
||||
class TaskInDB(TaskInDBBase):
|
||||
pass
|
||||
pass
|
||||
|
@ -40,4 +40,4 @@ class User(UserInDBBase):
|
||||
|
||||
# Additional properties stored in DB
|
||||
class UserInDB(UserInDBBase):
|
||||
hashed_password: str
|
||||
hashed_password: str
|
||||
|
12
main.py
12
main.py
@ -1,4 +1,3 @@
|
||||
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
@ -27,19 +26,18 @@ app.add_middleware(
|
||||
# Include API router
|
||||
app.include_router(api_router, prefix=settings.API_V1_STR)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
"""Root endpoint returning service information"""
|
||||
return {
|
||||
"title": settings.PROJECT_NAME,
|
||||
"docs": "/docs",
|
||||
"health": "/health"
|
||||
}
|
||||
return {"title": settings.PROJECT_NAME, "docs": "/docs", "health": "/health"}
|
||||
|
||||
|
||||
@app.get("/health", status_code=200)
|
||||
async def health_check():
|
||||
"""Health check endpoint"""
|
||||
return {"status": "healthy"}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|
||||
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from logging.config import fileConfig
|
||||
@ -88,4 +87,4 @@ def run_migrations_online():
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
run_migrations_online()
|
||||
run_migrations_online()
|
||||
|
@ -1,15 +1,16 @@
|
||||
"""init db
|
||||
|
||||
Revision ID: 001_init_db
|
||||
Revises:
|
||||
Revises:
|
||||
Create Date: 2023-11-14 12:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '001_init_db'
|
||||
revision = "001_init_db"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@ -18,51 +19,54 @@ depends_on = None
|
||||
def upgrade():
|
||||
# Create users table
|
||||
op.create_table(
|
||||
'user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=False),
|
||||
sa.Column('username', sa.String(), nullable=False),
|
||||
sa.Column('hashed_password', sa.String(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=True),
|
||||
sa.Column('is_superuser', sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
"user",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("email", sa.String(), nullable=False),
|
||||
sa.Column("username", sa.String(), nullable=False),
|
||||
sa.Column("hashed_password", sa.String(), nullable=False),
|
||||
sa.Column("is_active", sa.Boolean(), nullable=True),
|
||||
sa.Column("is_superuser", sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
|
||||
op.create_index(op.f('ix_user_id'), 'user', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
|
||||
op.create_index(op.f("ix_user_email"), "user", ["email"], unique=True)
|
||||
op.create_index(op.f("ix_user_id"), "user", ["id"], unique=False)
|
||||
op.create_index(op.f("ix_user_username"), "user", ["username"], unique=True)
|
||||
|
||||
# Create tasks table
|
||||
op.create_table(
|
||||
'task',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('title', sa.String(100), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('status', sa.Enum('todo', 'in_progress', 'done', name='taskstatus'), nullable=False),
|
||||
sa.Column('priority', sa.Enum('low', 'medium', 'high', name='taskpriority'), nullable=False),
|
||||
sa.Column('is_completed', sa.Boolean(), nullable=True),
|
||||
sa.Column('owner_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
"task",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("title", sa.String(100), nullable=False),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("status", sa.Enum("todo", "in_progress", "done", name="taskstatus"), nullable=False),
|
||||
sa.Column("priority", sa.Enum("low", "medium", "high", name="taskpriority"), nullable=False),
|
||||
sa.Column("is_completed", sa.Boolean(), nullable=True),
|
||||
sa.Column("owner_id", sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["owner_id"],
|
||||
["user.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f('ix_task_id'), 'task', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_task_title'), 'task', ['title'], unique=False)
|
||||
op.create_index(op.f("ix_task_id"), "task", ["id"], unique=False)
|
||||
op.create_index(op.f("ix_task_title"), "task", ["title"], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Drop tasks table
|
||||
op.drop_index(op.f('ix_task_title'), table_name='task')
|
||||
op.drop_index(op.f('ix_task_id'), table_name='task')
|
||||
op.drop_table('task')
|
||||
|
||||
op.drop_index(op.f("ix_task_title"), table_name="task")
|
||||
op.drop_index(op.f("ix_task_id"), table_name="task")
|
||||
op.drop_table("task")
|
||||
|
||||
# Drop enum types (only works in PostgreSQL, not SQLite)
|
||||
# No need to drop enums in SQLite
|
||||
|
||||
|
||||
# Drop users table
|
||||
op.drop_index(op.f('ix_user_username'), table_name='user')
|
||||
op.drop_index(op.f('ix_user_id'), table_name='user')
|
||||
op.drop_index(op.f('ix_user_email'), table_name='user')
|
||||
op.drop_table('user')
|
||||
op.drop_index(op.f("ix_user_username"), table_name="user")
|
||||
op.drop_index(op.f("ix_user_id"), table_name="user")
|
||||
op.drop_index(op.f("ix_user_email"), table_name="user")
|
||||
op.drop_table("user")
|
||||
|
Loading…
x
Reference in New Issue
Block a user