Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
typeflat
separatorpipe

Overview

Panel

Summary

Generic Sequence brings Hibernate's SequenceStyleGenerator to Liquibase

Current Version

1.0

Author

Michael Oberwasserlechner

SVN Repository

https://liquibase.jira.com/svn/CONTRIB/trunk/liquibase-genericsequence/trunk

Supported Databases

Should work for all

Purpose

The main purpose of the genericSequence extension is to be able to use Hibernate’s SequenceStyleGenerator as a database-independent way of creating IDs for tables.

...

  • CreateGenericSequence
  • DropGenericSequence

How it works

Depending on the used database the extension checks if sequences are supported or not. In the first case a sequence is used in the other case a table.

Usage

You can use this extension as a child element in your changeSets.

...

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  elementFormDefault="qualified">

  <xsd:element name="createGenericSequence">
    <xsd:complexType>
      <xsd:attribute name="schemaName" type="xsd:string"/>
      <xsd:attribute name="sequenceName" type="xsd:string" use="required"/>
      <xsd:attribute name="startValue" type="xsd:integer" default="1"/>
      <xsd:attribute name="minValue" type="xsd:integer"/>
      <xsd:attribute name="maxValue" type="xsd:integer"/>
      <xsd:attribute name="incrementBy" type="xsd:integer" default="1"/>
      <xsd:attribute name="forceTableUse" type="xsd:boolean" default="false"/>
      <xsd:attribute name="tableValueColumnName" type="xsd:string" default="next_val" />
      <xsd:attribute name="tableValueColumnSize" type="xsd:integer" default="10" />
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="dropGenericSequence">
    <xsd:complexType>
      <xsd:attribute name="schemaName" type="xsd:string" />
      <xsd:attribute name="sequenceName" type="xsd:string" use="required"/>
      <xsd:attribute name="forceTableUse" type="xsd:boolean" default="false"/>
    </xsd:complexType>
  </xsd:element>

</xsd:schema>

Files

Attachments
oldtrue