26 lines
763 B
Python
26 lines
763 B
Python
"""
|
|
Database configuration for Podcastrr.
|
|
"""
|
|
import sqlalchemy as sa
|
|
import sqlalchemy.orm as sa_orm
|
|
|
|
# Add compatibility for older SQLAlchemy versions
|
|
if not hasattr(sa_orm, 'DeclarativeBase'):
|
|
# Create a class that mimics DeclarativeBase for SQLAlchemy 1.4
|
|
class DeclarativeBase:
|
|
pass
|
|
# Monkey-patch sqlalchemy.orm
|
|
sa_orm.DeclarativeBase = DeclarativeBase
|
|
|
|
if not hasattr(sa_orm, 'DeclarativeBaseNoMeta'):
|
|
# Create a class that mimics DeclarativeBaseNoMeta for SQLAlchemy 1.4
|
|
class DeclarativeBaseNoMeta:
|
|
pass
|
|
# Monkey-patch sqlalchemy.orm
|
|
sa_orm.DeclarativeBaseNoMeta = DeclarativeBaseNoMeta
|
|
|
|
# Now import Flask-SQLAlchemy
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
# Create SQLAlchemy instance
|
|
db = SQLAlchemy()
|