Repository navigation
feat(entity-framework): Postgres DDL emitter + org/job control entities (Phase 3a) - #125
Merged
Merged
Conversation
…es (Phase 3a) Brings the control plane under the entity framework. Unlike the lake (NOT NULL only), control tables carry the constraints the dispatcher depends on. - er-entity-gen gains a Postgres DDL emitter: CREATE TABLE public.<rel> with each column's type/NOT NULL/DEFAULT/REFERENCES, accepted_values as a CHECK, the primary key from the entity key, and secondary indexes (incl. partial unique indexes with a WHERE). The Rust struct emitter now emits arrow_schema() only for entities that cross the Arrow wire — control entities are JSON-only. - entities/org and entities/job: the orgs and jobs tables as entities. The generated jobs DDL matches the hand-written pg.rs schema, with the five 32-bit integer columns (priority/attempt/max_attempts, orgs.active_config_version) widened to bigint — the vocabulary has no i32, exactly the one migration the design calls for. org.state renders its accepted_values as a CHECK. - Index gains a required `name` (Postgres indexes are named objects). Generated Org/Job structs compile (serde + utoipa, no arrow). Tests cover the widened integers, the reference, the partial unique index and the CHECK. The pg rewrite (RETURNING/ON CONFLICT/FOR UPDATE), control query functions and the Postgres oracle follow in 3b. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Brings the control plane under the entity framework. Unlike the lake (NOT NULL only), control tables carry the constraints the dispatcher's correctness depends on.
er-entity-gen):CREATE TABLE public.<rel>with each column's type / NOT NULL / DEFAULT / REFERENCES,accepted_values→ aCHECK, the primary key from the entity key, and secondary indexes (including partial unique indexes with aWHERE). The Rust struct emitter now emitsarrow_schema()only for Arrow-wire entities — control entities are JSON-only.entities/org,entities/job— theorgsandjobstables as entities. The generatedjobsDDL matches the hand-writtenpg.rsschema, with the five 32-bitintegercolumns (priority/attempt/max_attempts,orgs.active_config_version) widened tobigint— the vocabulary has noi32, which is exactly the one migration the design calls for.org.staterenders itsaccepted_valuesas aCHECK.Indexgains a requiredname(Postgres indexes are named objects).Verification
Generated
Org/Jobstructs compile (serde + utoipa, no arrow). Tests cover the widened integers, theREFERENCES, the partial unique index, and theCHECK.Next (3b)
The pg-clause rewrite (strip
RETURNING/ON CONFLICT/FOR UPDATE SKIP LOCKED), the control query functions (maptokio_postgres::Rowinto the struct by name — deletesjob_from_row), and the Postgres oracle (prepare_typed, gated onER_TEST_PG_DSN).🤖 Generated with Claude Code