stockpile-co / api

The API for Stockpile, an app that manages stuff for organizations.
0 stars 1 forks source link

Change item primary key to barcode #218

Closed AdamVig closed 7 years ago

AdamVig commented 7 years ago

Currently, the primary key of the item table is itemID, which is an auto-incremented value.

All of the item endpoints, however, use barcode for interacting with items. itemID is only really used by rentals, and even there, it gets in the way. It would be simpler to address items solely by their barcode.

The original concern with using barcode as a primary key was that it can change, but using ON UPDATE CASCADE in the database should fix that problem.

This change should allow for the removal of some joins in the rental and item endpoints.

Database

API