Files
wehub-resource-sync c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:02:24 +08:00

45 lines
2.0 KiB
Python

from datetime import datetime, timezone
from sqlalchemy import Column, DateTime, Integer, String
from cognee.infrastructure.databases.relational import Base
# The table has exactly one row, always with this id.
GLOBAL_DATABASE_VERSION_ROW_ID = 1
class GlobalDatabaseVersion(Base):
"""Single-row, deployment-wide version + global-database migration tracking.
``cognee_version`` is written on EVERY startup in BOTH access-control modes
— the one place to read which Cognee release last ran against this
deployment (the per-dataset ``dataset_database.cognee_version`` records
only which release last migrated that dataset's databases).
The ``global_migration_revision`` column applies only when backend access
control is disabled: in that mode one global graph/vector pair backs every
dataset (no ``dataset_database`` rows exist to carry revisions), so this
row tracks the pair's last-applied migration revision. With access control
enabled it stays NULL — the per-dataset revision lives on ``dataset_database``.
Standalone on purpose: no Dataset FK and no sentinel rows in user-facing
tables, so no query anywhere needs to filter anything out.
"""
__tablename__ = "global_database_version"
id = Column(Integer, primary_key=True, default=GLOBAL_DATABASE_VERSION_ROW_ID)
# Cognee release that last started against this deployment (both modes).
cognee_version = Column(String, nullable=True)
# Last-applied data-migration revision for the GLOBAL database pair
# (access control off only; one chain covers graph + vector + ledger).
# NULL means "no recorded revision" -> all migrations run.
global_migration_revision = Column(String, nullable=True)
# Why the last migration attempt failed (NULL when healthy).
global_migration_last_error = Column(String, nullable=True)
created_at = Column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
updated_at = Column(DateTime(timezone=True), onupdate=lambda: datetime.now(timezone.utc))