Im revisiting my database and noticed I had some primary keys that were of type INT.
This wasn\'t unique enough so I thought I would have a guid. I come from a mic
As far as stated in the documentation, you can use uid()
as a column default starting version 8.0.13, so something like this should work:
create table tbl_test (
guid binary(16) default (uuid_to_bin(uuid())) not null primary key,
name varchar(50) not null
);
This is pretty much copied from the documentation. I don't have a recent enough version of MySQL at hand to test this.