Discussion Forum

How do i implement this? AUTOINCREMENT

I have the below command :

add_structure(“CREATE TABLE IF NOT EXISTS epmem_wmes_constant (wc_id INTEGER PRIMARY KEY AUTOINCREMENT,parent_n_id INTEGER,attribute_s_id INTEGER, value_s_id INTEGER)”);

That I translated as:

epmem_wmes_constant sub entity,
owns wc_id @key,
owns parent_n_id,
owns attribute_s_id,
owns value_s_id,
wc_id sub attribute, value long,
parent_n_id sub attribute, value long,
attribute_s_id sub attribute, value long,
value_s_id sub attribute, value long;

But how do I implement the AUTOINCREMENT command?

Hi there -

at this point in time we don’t support an auto_increment! It’s definitely a useful feature, which for now you’ll have to generate on the client-side of your application.

Throw some weight behind this issue so we keep it on our radar! Introduce auto-generated / auto-incrementing keys · Issue #6175 · vaticle/typedb · GitHub