Initial curated RAGcore source from c16667f0c9397e2bfc8dd0255b114fba23c8d05e
This commit is contained in:
commit
7ca726caf2
659 files changed
+98171
No files matched your search
@@ -0,0 +1,47 @@
|
||||
"""How often a source should reconcile itself.
|
||||
|
||||
Until now a sync ran only when an operator asked for one, which made an index
|
||||
that keeps step with its folder or repository something a person had to
|
||||
remember rather than something the platform did. ``sync_interval_seconds``
|
||||
is what the scheduler reads.
|
||||
|
||||
Nullable, with no server default, on purpose. NULL means *only when asked* --
|
||||
exactly what every existing source already does -- so this migration changes
|
||||
the behaviour of precisely nothing until an operator sets an interval.
|
||||
Periodically reading someone's filesystem or repository is a decision, not
|
||||
something an upgrade should quietly begin doing.
|
||||
|
||||
The partial index covers the scheduler's only query: the sources that have an
|
||||
interval at all. In a deployment where most sources are manual, that index
|
||||
stays a fraction of the table.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0020_source_sync_schedule"
|
||||
down_revision = "0019_job_listing_index"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"sources",
|
||||
sa.Column("sync_interval_seconds", sa.Integer(), nullable=True),
|
||||
schema="content",
|
||||
)
|
||||
op.create_index(
|
||||
"ix_content_sources_due",
|
||||
"sources",
|
||||
["last_sync_at"],
|
||||
schema="content",
|
||||
postgresql_where=sa.text("sync_interval_seconds IS NOT NULL"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("ix_content_sources_due", "sources", schema="content")
|
||||
op.drop_column("sources", "sync_interval_seconds", schema="content")
|
||||
Reference in new issue
Block a user