The createSequence
and alterSequence
methods both take an options
argument that specifies parameters of sequence.
type
[string] - type of the sequenceincrement
[number] - sets first value of sequenceminvalue
[number or boolean] - sets minimum value of sequence orNO MINVALUE
(if value is false or null)maxvalue
[number or boolean] - sets maximum value of sequencee orNO MAXVALUE
(if value is false or null)start
[number] - sets first value of sequencecache
[number] - sets how many sequence numbers should be preallocatedcycle
[boolean] - addsCYCLE
orNO CYCLE
clause if option is presentowner
[string or boolean] - sets owner of sequence or no owner (if value is false or null)
Create a new sequence - postgres docs
Arguments:
sequence_name
[Name] - name of the new sequenceoptions
[object] - options:- sequence options -- see sequence options section
temporary
[boolean] - addsTEMPORARY
clauseifNotExists
[boolean] - addsIF NOT EXISTS
clause
Reverse Operation: dropSequence
Drop a sequence - postgres docs
Arguments:
sequence_name
[Name] - name of the the sequence to dropdrop_options
[object] - options:ifExists
[boolean] - drops sequence only if it existscascade
[boolean] - drops also dependent objects
Alter a sequence - postgres docs
Arguments:
sequence_name
[Name] - name of the new sequenceoptions
[object] - options:- sequence options -- see sequence options section
restart
[number or boolean] - sets first value of sequence or usingstart
value (on true value)
Rename a sequence - postgres docs
Arguments: