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)
Summary
Feature tables (created dynamically in the
featuresPG schema) currently use a plainrecord_srn TEXTcolumn to link back torecords.srn. This should be an actual foreign key constraint.Why
Changes
PostgresFeatureStore.create_table, change therecord_srncolumn definition to includeREFERENCES records(srn)