-
Notifications
You must be signed in to change notification settings - Fork 2
Home
The SequenceTable extension allows databases that do not support sequences to natively create "sequence tables". Sequence tables can be used by Hibernate for its SequenceStyleGenerator functionality or used directly through SQL.
This extension adds both transparent sequence table support and manual sequence table support.
With this extension installed, any database that will does not support sequences will automatically create a table with the same name as the sequence containing a "next_value" column.
For example:
<createSequence sequenceName="person_seq" />
on Oracle will create a sequence called "person_seq" and on MySQL will create a table called person_seq and populate it with a row specifying next_value=1.
Similarly,
<dropSequence sequenceName="person_seq" />
will drop a sequence named person_seq on Oracle and a table called person_seq.
If you would like to manage sequence tables directly, you can specify and commands in a changeSet. If the database supports sequences, the change will do nothing unless you specify alwaysUse=true.
The extension XSD can be referenced from https://github.com/liquibase/liquibase-sequencetable/blob/master/src/main/resources/liquibase/ext/sequencetable/dbchangelog-sequencetable.xsd
<changeSet id="example" author="bob">
<createSequenceTable tableName="person_seq"/>
</changeSet>
<changeSet id="example-2" author="bob">
<dropSequenceTable tableName="person_seq"/>
</changeSet>
CreateSequenceTable supports the following attributes:
- catalogName
- schemaName
- tableName
- startValue
- nextValueColumnName Name of 'next_value' column to use
- alwaysUse Create table even if the database supports sequences
Simply download the liquibase-sequence jar from the release page and add it to your classpath.
This extension requires Liquibase 3.0.6+ and Java 1.6+.
Use the project issue tracker to log any issues or feature requests
Pull requests are greatly appreciated