Giter Club home page Giter Club logo

liquibase-mssql's Introduction

Maven Central

liquibase-mssql

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

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

Download statistics

alt text

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)

liquibase-mssql's People

Contributors

cplaetzinger avatar jlaacke avatar sabomichal avatar scrain avatar twhitbeck avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.