Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 2.79 KB

File metadata and controls

66 lines (46 loc) · 2.79 KB

Sequence Operations

pgm.createSequence( sequence_name, type, options )

Create a new sequence - postgres docs

Arguments:

  • sequence_name [string] - name of the new sequence
  • options [object] - options:
    • temporary [boolean] - adds TEMPORARY clause
    • ifNotExists [boolean] - adds IF NOT EXISTS clause
    • type [string] - type of the sequence
    • increment [number] - sets first value of sequence
    • minvalue [number or boolean] - sets minimum value of sequence or NO MINVALUE (on false or null value)
    • maxvalue [number or boolean] - sets maximum value of sequencee or NO MAXVALUE (on false or null value)
    • start [number] - sets first value of sequence
    • cache [number] - sets how many sequence numbers should be preallocated
    • cycle [boolean] - adds CYCLE or NO CYCLE clause if option is present
    • owner [string or boolean] - sets owner of sequence or no owner (on false or null value)

Reverse Operation: dropSequence


pgm.dropSequence( sequence_name, drop_options )

Drop a sequence - postgres docs

Arguments:

  • sequence_name [string] - name of the the sequence to drop
  • drop_options [object] - options:
    • ifExists [boolean] - drops sequence only if it exists
    • cascade [boolean] - drops also dependent objects

pgm.alterSequence( sequence_name, options )

Alter a sequence - postgres docs

Arguments:

  • sequence_name [string] - name of the new sequence
  • options [object] - options:
    • type [string] - type of the sequence
    • increment [number] - sets first value of sequence
    • minvalue [number or boolean] - sets minimum value of sequence or NO MINVALUE (on false or null value)
    • maxvalue [number or boolean] - sets maximum value of sequencee or NO MAXVALUE (on false or null value)
    • start [number] - sets first value of sequence (no effect until restart)
    • restart [number or boolean] - sets first value of sequence or using start value (on true value)
    • cache [number] - sets how many sequence numbers should be preallocated
    • cycle [boolean] - adds CYCLE or NO CYCLE clause if option is present
    • owner [string or boolean] - sets owner of sequence or no owner (on false or null value)

pgm.renameSequence( old_sequence_name, new_sequence_name )

Rename a sequence - postgres docs

Arguments:

  • old_sequence_name [string] - old name of the sequence
  • new_sequence_name [string] - new name of the sequence