Liquibase MS SQL Server Extensions

Liquibase extensions for MS SQL Server.

License

License

Categories

Categories

Liquibase Data Databases
GroupId

GroupId

com.github.sabomichal
ArtifactId

ArtifactId

liquibase-mssql
Last Version

Last Version

1.6.4
Release Date

Release Date

Type

Type

jar
Description

Description

Liquibase MS SQL Server Extensions
Liquibase extensions for MS SQL Server.
Project URL

Project URL

https://github.com/sabomichal/liquibase-mssql
Source Code Management

Source Code Management

https://github.com/sabomichal/liquibase-mssql

Download liquibase-mssql

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.sabomichal/liquibase-mssql/ -->
<dependency>
    <groupId>com.github.sabomichal</groupId>
    <artifactId>liquibase-mssql</artifactId>
    <version>1.6.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.sabomichal/liquibase-mssql/
implementation 'com.github.sabomichal:liquibase-mssql:1.6.4'
// https://jarcasting.com/artifacts/com.github.sabomichal/liquibase-mssql/
implementation ("com.github.sabomichal:liquibase-mssql:1.6.4")
'com.github.sabomichal:liquibase-mssql:jar:1.6.4'
<dependency org="com.github.sabomichal" name="liquibase-mssql" rev="1.6.4">
  <artifact name="liquibase-mssql" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.sabomichal', module='liquibase-mssql', version='1.6.4')
)
libraryDependencies += "com.github.sabomichal" % "liquibase-mssql" % "1.6.4"
[com.github.sabomichal/liquibase-mssql "1.6.4"]

Dependencies

compile (1)

Group / Artifact Type Version
org.liquibase : liquibase-core jar 3.4.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Maven Central

liquibase-mssql

Fork of Liquibase MS SqlServer Extensions extension - https://liquibase.jira.com/wiki/display/CONTRIB/MS+SqlServer+Extensions. Pull requests welcome.

This fork adds following functionality:

  • it is Liquibase 3.x ready (currently supported version: 3.4.2)
  • supports stored procedures drop
  • wraps flagged calls to loadData with "set identity insert on" and "set identity insert off" - see sample
  • wraps flagged calls to insert with "set identity insert on" and "set identity insert off" - see sample
  • adds support to createIndex for specifying included columns and fill-factor
  • adds support to addPrimaryKey for specifying fill-factor

Usage

To use, simply include the liquibase-mssql.jar file in your classpath. And add the ext namespace to your xml root node:

<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

Available changes/refactorings

Change: ‘insert’

Extends insert data changeset with identityInsertEnabled property.

New Attributes

identityInsertEnabled - boolean - when set to true, allows explicit values to be inserted into the identity column of a table.

Sample

<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

	<changeSet id="00000000000001" author="author">

		<createTable tableName="person">
			<column name="id" autoIncrement="true" type="BIGINT">
				<constraints nullable="false" primaryKey="true" primaryKeyName="pk_person_id"/>
			</column>
			<column name="address" type="varchar(255)"/>
		</createTable>

		<ext:insert tableName="person" identityInsertEnabled="true">
			<column name="id" valuenumeric="100" />
			<column name="address" value="thing" />
		</ext:insert>

	</changeSet>

</databaseChangeLog>

Change: ‘loadData’

Extends load data changeset with identityInsertEnabled property.

New Attributes

identityInsertEnabled - boolean - when set to true, allows explicit values to be inserted into the identity column of a table.

Sample

...		
<ext:loadData encoding="UTF-8"
	file="classpath:config/liquibase/persons.csv" separator=";"
	tableName="person" identityInsertEnabled="true" />
...

Change: 'createIndex'

Extends create index change with includedColumns and fillFactor properties. Properties clustered and descending are supported.

New attributes

includedColumns - string - columns to be included in index (comma separated if multiple)

fillFactor - int (1 to 100) - specifies a percentage that indicates how full the Database Engine should make the leaf level of each index page during index creation or rebuild

Sample

...
<ext:createIndex indexName="IDX_first_name" tableName="person" includedColumns="id, last_name, dob" fillFactor="50">
  <column name="first_name" />
</ext:createIndex>
...

Change: 'addPrimaryKey'

Extends add primary key change with fillFactor property

New attribute

fillFactor - int (1 to 100) - specifies a percentage that indicates how full the Database Engine should make the leaf level of each index page during index creation or rebuild

Sample

...
<ext:addPrimaryKey columnNames="id" constraintName="pk_mytable_id" tableName="mytable" fillFactor="70" />
...

Refactoring: Changed check if table has an identity column

Changes identity column check not to use global tables to enable usage of multiple Liquibase instances simultaneously with the same database (but with different schemas)

Versions

Version
1.6.4
1.6.3
1.6.2
1.6.1
1.6
1.5
1.4.1
1.4
1.3.4