Skip to content

Ensure global uniqueness of Tariff.product + what? #38

@forsberg

Description

@forsberg

With #9 closed, Tariff.product got a more clear role, which is good.

In our use case, we will have to store which tariff each of our customers is using, and hence, we need some kind of unique ID to be able to connect the customer with a tariff. Using Tariff.product makes sense at it will help with the lifecycle handling.

However, as Tariff.product is only unique on a per company level, how do we ensure we have a unique key for company + Tariff.product in our database? Or in very concrete terms - what combination of keys should we use in an SQL database to form our uniqeness index?

  • Using Tariff.companyName would be one option, but companies tend to change name from time to time, so I don't see this as a good option.
  • Using Tariff.companyOrgNo might be a better option, but.. are we sure this will work on an European level? One idea might be to force it to be a European VAT identification number instead of a swedish organization number.
  • I could use the URL of the API, but that might also change. It's a bit clumsy, and one API might include tariffs from multiple companies (See Tekniska Verken API, contains data from three companies). API URL + companyOrgNo + product might be unique, but again, a bit clumsy.
  • Other ideas would be to always prefix the Tariff.product with a UUID. Or have a separate field which is a UUID for the product. This would be globally unique.

Would be great if the specification was more clear on this.

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