feat: add asset manifest knowledge ingest
This commit is contained in:
@@ -246,6 +246,45 @@ class IngestionRun(Base):
|
||||
)
|
||||
|
||||
|
||||
class AssetIngestJob(Base):
|
||||
__tablename__ = "asset_ingest_jobs"
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"asset_id",
|
||||
"sha256",
|
||||
"manifest_version",
|
||||
name="uq_asset_ingest_identity",
|
||||
),
|
||||
Index("ix_asset_ingest_document", "document_id"),
|
||||
Index("ix_asset_ingest_asset", "asset_id"),
|
||||
Index("ix_asset_ingest_owner", "owner_module", "owner_record_type", "owner_record_id"),
|
||||
)
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
document_id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("documents.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
asset_id: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
manifest_version: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
sha256: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
owner_module: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
owner_record_type: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
owner_record_id: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="QUEUED")
|
||||
idempotency_key: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
storage_bucket: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
storage_key: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
storage_version_id: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
manifest_json: Mapped[dict[str, Any]] = mapped_column("manifest", JSONB, nullable=False)
|
||||
ingest_options: Mapped[dict[str, Any]] = mapped_column(JSONB, nullable=False, default=dict)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), nullable=False
|
||||
)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class ProcessingEvent(Base):
|
||||
__tablename__ = "processing_events"
|
||||
__table_args__ = (
|
||||
|
||||
Reference in New Issue
Block a user