make a few columns in the listing model indices to help with search

This commit is contained in:
Viktor Barzin 2025-06-30 22:57:41 +00:00
parent 92c8403157
commit 5adffc8dcf
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
3 changed files with 58 additions and 5 deletions

View file

@ -1,6 +1,10 @@
import os
from sqlmodel import create_engine, SQLModel
from sqlalchemy.orm import sessionmaker
from dotenv import load_dotenv
load_dotenv()
# PostgreSQL example (or use "sqlite:///database.db" for SQLite)
# DATABASE_URL = "postgresql://user:password@localhost/db_name"
@ -9,7 +13,8 @@ from sqlalchemy.orm import sessionmaker
DATABASE_URL = os.environ["DB_CONNECTION_STRING"]
engine = create_engine(DATABASE_URL, echo=False) # `echo=True` for debug logs
debug = os.getenv("ENV", "dev") == "prod"
engine = create_engine(DATABASE_URL, echo=debug) # `echo=True` for debug logs
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)