Skip to content

refactor: add foreign key constraint from feature tables to records #75

@rorybyrne

Description

@rorybyrne

Summary

Feature tables (created dynamically in the features PG schema) currently use a plain record_srn TEXT column to link back to records.srn. This should be an actual foreign key constraint.

Why

  • pg_graphql (and similar tools) auto-discover relationships via FK constraints — no need for comment directives
  • Referential integrity enforced at the DB level
  • Our insert volumes don't warrant avoiding FK overhead

Changes

  • In PostgresFeatureStore.create_table, change the record_srn column definition to include REFERENCES records(srn)
  • Verify bulk insert performance is acceptable with the constraint
  • Add migration for any existing feature tables (if any exist in deployed environments)

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorInternal restructuring, no behavior change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions