feat(expense): add persistent zero-entry receipt association
This commit is contained in:
@@ -19,7 +19,7 @@ from app.db.schema_ownership import MIGRATION_OWNED_TABLES, create_legacy_schema
|
||||
|
||||
MIGRATION_TEST_DATABASE_URL = os.getenv("MIGRATION_TEST_DATABASE_URL", "").strip()
|
||||
LEGACY_PROBE_TABLE = "legacy_migration_probe_records"
|
||||
HEAD_REVISION = "20260714_0005"
|
||||
HEAD_REVISION = "20260716_0006"
|
||||
SERVER_DIR = Path(__file__).resolve().parents[1]
|
||||
ALEMBIC_INI_PATH = SERVER_DIR / "alembic.ini"
|
||||
|
||||
@@ -274,11 +274,27 @@ def _assert_head_schema(engine: Engine) -> None:
|
||||
"uq_memory_evidence_links_entry_case",
|
||||
("tenant_id", "memory_entry_id", "expense_case_id"),
|
||||
)
|
||||
_assert_unique_constraint(
|
||||
engine,
|
||||
"attachment_association_jobs",
|
||||
"uq_attachment_association_jobs_owner_dedupe",
|
||||
("tenant_id", "owner_username", "dedupe_key", "generation"),
|
||||
)
|
||||
_assert_check_constraint(
|
||||
engine,
|
||||
"memory_entries",
|
||||
"ck_memory_entries_expired_fields",
|
||||
)
|
||||
_assert_check_constraint(
|
||||
engine,
|
||||
"attachment_association_jobs",
|
||||
"ck_attachment_association_jobs_running_lease",
|
||||
)
|
||||
_assert_check_constraint(
|
||||
engine,
|
||||
"attachment_association_jobs",
|
||||
"ck_attachment_association_jobs_generation",
|
||||
)
|
||||
|
||||
_assert_indexes(
|
||||
engine,
|
||||
@@ -318,6 +334,21 @@ def _assert_head_schema(engine: Engine) -> None:
|
||||
"ix_auth_sessions_tenant_username": ("tenant_id", "username"),
|
||||
},
|
||||
)
|
||||
_assert_indexes(
|
||||
engine,
|
||||
"attachment_association_jobs",
|
||||
{
|
||||
"ix_attachment_association_jobs_owner_time": (
|
||||
"tenant_id",
|
||||
"owner_username",
|
||||
"created_at",
|
||||
),
|
||||
"ix_attachment_association_jobs_status_lease": (
|
||||
"status",
|
||||
"lease_expires_at",
|
||||
),
|
||||
},
|
||||
)
|
||||
_assert_indexes(
|
||||
engine,
|
||||
"ai_application_preview_decisions",
|
||||
|
||||
Reference in New Issue
Block a user