Hello - I was totally and completely blown away when i did a simple cut/paste and had this fantatic sequelize example working.
This particular Sequelize example force-creates an id column like so:
SHOW COLUMNS FROM accounts;
+-----------+-----------+-------+----------------+-----------+
| Field | Type | Null | Default | Indices |
+-----------+-----------+-------+----------------+-----------+
| id | INT | false | NULL | {primary} |
However, from reading this, cockroach has a superior way of handling unique primary keys using SERIAL UUID.
Would it be possible do an insert without having to specify the âidâ column? i would really like to take advantage of the SERIAL UUID feature.
I took an uneducated guess and tried the following sequelize types (but none of these feeble attempts worked)
- Sequelize.unique_rowid
- Sequelize.uniquerowid
- Sequelize.UNIQUE_ROWID
- Sequelize.UNIQUEROWID
A possible workaround to be to generate my own UUID, but hey, this is cockroachdb after all !
and a special thank you to Cuong Do for creating the sequelize interface.
EDIT: in other words, i am able to do the following using the CLI:
create table accounts (id SERIAL PRIMARY KEY, balance int, createdAt timestamp, updatedAt timestamp ) ;
insert into accounts (balance) values ( 1234 ) ; ## we can conveniently omit the id column.
Notice i did not specify the âidâ column, the geniuses at cockroachdb generate a UUID for me. i would like to do the same using Sequelize.