
- Add requirements.txt file to git - Add project files to git - Fix linting issues in task.py and env.py - Update SQLAlchemy queries to use 'not' instead of '== False' - Fix import ordering in env.py
20 lines
621 B
Python
20 lines
621 B
Python
from datetime import datetime
|
|
from typing import Any
|
|
|
|
from sqlalchemy import Column, DateTime
|
|
from sqlalchemy.ext.declarative import as_declarative, declared_attr
|
|
|
|
|
|
@as_declarative()
|
|
class Base:
|
|
id: Any
|
|
__name__: str
|
|
|
|
# Generate __tablename__ automatically based on class name
|
|
@declared_attr
|
|
def __tablename__(cls) -> str:
|
|
return cls.__name__.lower()
|
|
|
|
# Add created_at and updated_at columns to all models
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False) |