Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/wApp. Web App Store project to improve Web App discoverability written in Python for a u
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829"""A module to set up the database"""from sqlalchemy import event, create_enginefrom sqlalchemy.engine import Enginefrom sqlalchemy.ext.declarative import declarative_basefrom sqlalchemy.orm import sessionmaker
# All the things for setting up the databaseSQLALCHEMY_DATABASE_URL = "sqlite:///wapp.db"
engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False})
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
@event.listens_for(Engine, "connect")def enable_cascade(dbapi_connection, _): """ Cascade does not work without this and we need it for auto deleting icons and screenshots """ cursor = dbapi_connection.cursor() cursor.execute("PRAGMA foreign_keys=ON") cursor.close()