SQLite triggers to track table changes
playtechnique.io
playtechnique.io
I found one statement confusing in this post: "I can't add a primary key after the fact to my inputs table; it's not supported".
I have added PKs to existing tables before, what does the author mean by that?
It _does_ seem like you can add a primary key later in mysql and postgres, but I don't see any way to accomplish that in sqlite.
So you were correct originally, it can't just add a PK.
Thanks for following up!
I'm just old.
As in, when I started my career I worked on an application that was written 15 years earlier. It taught me a lot.
As in around 1990. Guess what? It used database triggers to keep a record of every change ever made to any table in an "archive" table. When I joined the project I was able to see every single change any user made ever since the application was built.
And yes you very probably bought a product that was planned and administered through that application.
So to try and save this post: go learn and explore! I do implore you to try and look around and away from specifics like the technology you are using being SQLite. Look beyond. Look at the concepts. Figure out that things repeat in history. Every generation re-invents some wheels. Recognize them and try to recognize if there are slight differences and improvements in the re-inventions or if it's just more layers upon layers. Or in this case is it just that SQLite is gaining/having more and more features of "real databases" even though it's mostly touted as an "embedded database"?
It has one SQLite database per tenant.