Change: ‘createSequence’

Creates a new database sequence

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogall3.0
cycleCan the sequence cycle when it hits the max value?all
incrementByInterval between sequence numbersinformix, hsqldb, postgresql, db2, oracle, h2
maxValueThe maximum value of the sequenceinformix, postgresql, db2, oracle
minValueThe minimum value of the sequenceinformix, postgresql, db2, oracle
orderedDoes the sequence need to be guaranteed to be genererated inm the order of request?informix, hsqldb, postgresql, oracle, firebird, h2
schemaNameName of the schemaall
sequenceNameName of the sequence to createallall
startValueThe first sequence number to be generated.informix, hsqldb, postgresql, db2, oracle, h2
<changeSet author="liquibase-docs" id="createSequence-example">
    <createSequence catalogName="cat"
            cycle="true"
            incrementBy="2"
            maxValue="1000"
            minValue="10"
            ordered="true"
            schemaName="public"
            sequenceName="seq_id"
            startValue="5"/>
</changeSet>
changeSet:
  id: createSequence-example
  author: liquibase-docs
  changes:
  - createSequence:
      catalogName: cat
      cycle: true
      incrementBy: 2
      maxValue: 1000
      minValue: 10
      ordered: true
      schemaName: public
      sequenceName: seq_id
      startValue: 5
{
  "changeSet": {
    "id": "createSequence-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "createSequence": {
          "catalogName": "cat",
          "cycle": true,
          "incrementBy": 2,
          "maxValue": 1000,
          "minValue": 10,
          "ordered": true,
          "schemaName": "public",
          "sequenceName": "seq_id",
          "startValue": 5
        }
      }]
    
  }
}

SQL Generated From Above Sample (Oracle)

CREATE SEQUENCE cat.seq_id START WITH 5 INCREMENT BY 2 MINVALUE 10 MAXVALUE 1000 ORDER CYCLE;

Database Support

DatabaseNotesAuto Rollback
DB2SupportedYes
DerbyNot SupportedYes
FirebirdSupportedYes
H2SupportedYes
HyperSQLSupportedYes
InformixSupportedYes
MySQLNot SupportedYes
OracleSupportedYes
PostgreSQLSupportedYes
SQL ServerNot SupportedYes
SQLiteNot SupportedYes
SybaseNot SupportedYes
Sybase AnywhereNot SupportedYes

Missing, incomplete or wrong information? Please send a pull request