Start value of an Autoincrement

Hi All,
Is it safe to just alter from the database the next Sequence Number for a doctype with Naming Rule set “Autoincrement”? Bassically, I wanted the name field of the doctype to start from 60001.
Here is what I did:

select setval(my_doctype_name_id_seq,60001,false);

This works just fine upon creating new documents. I just want to make sure no future issues after this.


Hi @dave-greeko i think it’s okay to do that.
This is how frappe set the autoincrement value


So i think it’s pretty much the same as yours

Thank you! and while at it, if anyone is looking to accomplish the same thing and when the table is empty altering the sequence definition is also required.

select setval(my_doctype_name_id_seq, 100001,false);
ALTER SEQUENCE my_doctype_name_id_seq MINVALUE 100001 start 100001;
1 Like