aquametalabs / aquameta

Web development platform built entirely in PostgreSQL
GNU General Public License v3.0
1.1k stars 52 forks source link

sha256 pk for tables with name identifiers #226

Open erichanson opened 3 years ago

erichanson commented 3 years ago

Tables like bundle, widget, etc. have both a id primary key, and a name field that is effectively a secondary key, since it's used as such throughout the code. We need a human-readable identifier, because of course we don't want to do things like

w.find('div.mine').html(widget('12312-12312-123-12312312', { args...} ));

because it's unreadable and not human friendly at all. We also could just make name primary key, which I actually don't hate. But short of that, one middle ground would be to set the primary key to be the sha256 of the name. That way they are coupled together.

I actually kind of just want to make name primary key and drop id, come to think of it.