feat(frontend): composite primary key support end-to-end (#148)#222
Draft
saurabh500 wants to merge 1 commit into
Draft
feat(frontend): composite primary key support end-to-end (#148)#222saurabh500 wants to merge 1 commit into
saurabh500 wants to merge 1 commit into
Conversation
…B#148) - Adds pk_ordinal to TableColumn (Rust + TS) across all four drivers - New update_record_composite / delete_record_composite trait methods + Tauri commands - DataGrid accepts pkColumns and routes inline edits through composite invoke - Editor derives ordered composite PK from columnMetadata and forwards it - SchemaDiagram groups FK rows by constraint name and styles composite FKs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Implements frontend composite primary key support across the stack, resolving #148.
Builds on the SQL Server backend composite PK work in #146/#147. Existing single-PK behavior is preserved; composite-PK tables now display correctly and inline edits route through dedicated composite commands.
Changes
Backend (Rust)
models::TableColumn— addedpk_ordinal: Option<u32>(1-based position within the PK, matching SQL Serverkey_ordinal, MySQLSEQ_IN_INDEX, SQLite pragmapk, Postgreskcu.ordinal_position).sqlserver,mysql,postgres,sqlite) now populatepk_ordinalinget_columnsandget_all_columns_batch. Postgres readsinformation_schema.key_column_usage.ordinal_position. View columns are set toNone.driver_trait— new default methodsupdate_record_compositeanddelete_record_composite. Whenpk_cols.len() == 1they delegate to the single-PK path; otherwise they return a descriptive error so non-overriding drivers fail loudly instead of corrupting data.update_record_composite/delete_record_composite, registered inlib.rs.Frontend (TypeScript / React)
TableColumntype — addedpk_ordinal?: numberin bothsrc/types/editor.tsandsrc/types/schema.ts.DataGrid— new optionalpkColumns?: string[]prop alongside legacypkColumn. BuildspkIndexesmemo, derivesisCompositePk, and routes inline cell updates throughupdate_record_compositewhen composite. Single-PK path unchanged.Editor.tsx— derives the ordered composite PK list fromcolumnMetadata(filteris_pk, sort ascending bypk_ordinal) and passes it toDataGrid.SchemaDiagram— groups foreign keys by constraint name and styles composite-FK edges distinctly (thicker purple line + constraint label).Verification
cargo check --lib✅cargo test --lib✅ 605 passing (2 pre-existing failures inupdater::testsunrelated to this PR)npm run typecheck✅SchemaDiagramuseEffect)Notes
pk_ordinalis intentionally optional in the TS type so any cached column metadata from older sessions still deserializes.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com