1

We are rewriting from a huge monolithic application to smaller application using rest.

While the old application had one huge tables called REFERENCE tables with applicable values had all these ids and codes and names and description. The other tables had references using ids. E.g Current Design

Tbl_Status_Types

 +---------------+----------------+---------+
 | id            | code           |  name   |
 +---------------+----------------+---------+
 |             1 |              O | Open    |
 |             2 |              C | Close   |
 +---------------+----------------+---------+

Tbl_Order

     +---------------+----------------+---------+
     | order_id      | cust_id        |fk_status|
     +---------------+----------------+---------+
     |             1 |              O | O or 1  |
     |             2 |              C | C or 2  |
     +---------------+----------------+---------+

Question:

  • Should the Foreign Key FK_Status be referencing ID or CODE
  • what value adding a CODE would add to other than readability and is it maintainable?
  • if you are exposing your rest endpoint for an operation to update status - which value would you expose name or code