netspective-labs / sql-aide

SQL Aide (SQLa) Typescript template literal text supplier optimized for emitting SQL
https://www.sql-aide.com/
MIT License
10 stars 17 forks source link

Refactor assurance model with ulidPrimaryKey() #167

Open geovlazar opened 8 months ago

geovlazar commented 8 months ago

Infra Assurance model uses autoIncPK which causes duplication while merging with other databases.

Infra Assurances model is designed in a way to use autoinfrement primary key for all its tables and it generates data without any issues. but when we think about we are using the same with multiple

Generalize the primary with the ULID model which supports merging and combining different models

Update all models by replacing autoIncPK to ulidPrimaryKey() to support our tables with multiple systems

jobyjames1 commented 7 months ago

During the process of changing 'autoIncPK' to 'ulidPrimaryKey()' for the key-value pair of enum tables, we encountered an issue with the insertDML, resulting in the error:

Type '{ code: string; value: string; }' is not assignable to type 'InsertableRecord'.
  Property 'id' is missing in type '{ code: string; value: string; }' but required in type 'Omit<Omit<EntireRecord, never>, never>'.deno-ts(2322)

As discussed previously, we have decided to temporarily ignore changing 'autoIncPK' to 'ulidPrimaryKey' for the following enum tables due to this issue.

  1. contract_status
  2. payment_type
  3. periodicity
  4. boundary_nature
  5. time_entry_category
  6. raci_matrix_subject
  7. skill_nature
  8. skill
  9. asset_status
  10. asset_service_status
  11. asset_type
  12. assignment
  13. threat_source_type
  14. threat_event_type
  15. calendar_period
  16. tracking_period
  17. audit_purpose
  18. audit_status
  19. training_subject
  20. status_value
  21. rating_value
  22. contract_type
  23. graph_nature
  24. asset_risk_type
  25. risk_subject
  26. risk_type
  27. incident_category
  28. incident_sub_category