While it can done by code, it would be much much much convenience if the system makes it automatically with AUTO_INCREMENT column. So that this kind of issue 1 and issue 2 can be solved without headache and confusion
Finally, I can rely to my boss who just has basic IT knowledge when he says “mysql has it”
If used as the designers intended, Anvil row ids are, in fact, very reliable.
A row id can’t change while a program has it in memory. This allows row ids to be passed back and forth between server and client, and still refer to the same record every time they are used.
Columns of type Link do, in fact, store Row ids. If Anvil must change a row id – which, as far as I can tell, has never happened – Anvil can therefore track down any matching Link-column values, and change them to match the new id. If the format of Anvil’s row ids must change, then Anvil takes responsibility for updating all the valid Links.
That said, other column types can certainly be handy for “ids”, if they are used in other ways. If an id is generated externally, for example, and used to keep sync with external databases, then you need whatever column type can hold that value.
If you need an id that is
generated by Anvil
guaranteed never to change in value or type
then auto-increment can make a lot of sense. (So can an automatic timestamp, for that matter. Or a GUID. Or a very large random number. It really depends on what you’re doing.)
Note that maintaining a counter, and preventing conflicts from multiple users (each trying to create “the next” record at effectively the same time), has some overhead. On the other hand, doing it ourselves requires us to write code, and there’s a really good chance of our getting it incomplete, or outright wrong. This is probably why every major database provides a built-in auto-increment option.
would be fine
since in this case I’m not relying on the format of the id, and
I’m not hard coding it into my project
but I’m instead relying on the promise that anvil will give me an id if I ask for one
and will get me a row if I give it a valid id.