"""Declarative base shared by every model. Alembic's env.py points its
target_metadata here for autogenerate support (from M2 on)."""

from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.types import JSON

# JSONB on Postgres; plain JSON on SQLite so unit tests can exercise the
# models without a Postgres instance.
PortableJSON = JSON().with_variant(JSONB(), "postgresql")

#: Sentinel inside expression unique indexes so a NULL "project-wide"
#: rate-override rule is unique too (carried from the legacy
#: project_rate_overrides_unique index — 01-current-system/schema.md §13).
ZERO_UUID = "00000000-0000-0000-0000-000000000000"


class Base(DeclarativeBase):
    pass
