Skip to content

Use PKs for cross-referencing instead of business/natural keys #1497

@goekay

Description

@goekay

Checklist

  • I checked other issues already and found no answer
  • I checked the documentation and found no answer
  • I am running the latest version and the feature i am requesting is not implemented there

Describe the problem you are trying to solve

We are using a mix of PK and natural key references when it comes to cross-referencing between tables. A benefit of referencing natural keys was: They are there, whenever we need to use them. Additional resolution will be necessary with PKs as the men in the middle to arrive at natural keys. This was the primary motivation to leave them as is.

The following tables are subject for this problem:

  • connector referencing charge_box_id
  • ocpp_tag referencing parent_id_tag
  • reservation referencing id_tag
  • transaction_start referencing id_tag

Describe the solution you'd like

  • connector should reference charge_box_pk
  • ocpp_tag should reference ocpp_tag_pk of the same table to express parent id tag
  • reservation should reference ocpp_tag_pk
  • transaction_start should reference ocpp_tag_pk

Describe alternative solutions or features you've considered

Leave as is: Not a clean solution. Might block developing some features.

Additional context

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions