Liquibase Spatial

Liquibase Spatial extends Liquibase to handle spatial indexing and geometry types

License

License

Categories

Categories

Liquibase Data Databases
GroupId

GroupId

com.github.lonnyj
ArtifactId

ArtifactId

liquibase-spatial
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

Liquibase Spatial
Liquibase Spatial extends Liquibase to handle spatial indexing and geometry types
Source Code Management

Source Code Management

https://github.com/lonnyj/liquibase-spatial

Download liquibase-spatial

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
com.vividsolutions : jts jar 1.13
org.liquibase : liquibase-core jar 3.3.0

test (5)

Group / Artifact Type Version
com.h2database : h2 jar 1.4.177
net.sourceforge.hatbox » hatbox jar 1.0.b9
org.mockito : mockito-core jar 1.10.19
org.opengeo » geodb jar 0.8
org.testng : testng jar 6.8.17

Project Modules

There are no modules declared in this project.

Liquibase Spatial

Liquibase Spatial is an extension to Liquibase to handle spatial indexing and geometry types. It requires Liquibase 3.1.1 or newer.

Liquibase Version Liquibase Spatial Version
Liquibase 3.1.1 Liquibase Spatial 1.0.x
Liquibase 3.2.x Liquibase Spatial 1.1.x
Liquibase 3.3.x Liquibase Spatial 1.2.x

In order to use this extension, you must have the liquibase-spatial jar in your classpath. For XML change logs, define the spatial namespace as below:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
   xmlns:spatial="http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-spatial"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd 
   http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-spatial 
      http://lonnyj.github.com/liquibase-spatial/liquibase-spatial.xsd">
</databaseChangeLog>

Using the XML elements defined by this extension requires specifying the spatial namespace prefix on those elements. Here is a quick example of how to create a table with a geometry column, create a spatial index on that column, and insert data into the table:

<changeSet id="Create table" author="bob">
   <preConditions>
      <spatial:spatialSupported />
   </preConditions>
   <createTable tableName="EXAMPLE">
      <column name="ID" type="BIGINT">
         <constraints nullable="false" primaryKey="true" primaryKeyName="EXAMPLE_PK" />
      </column>
      <column name="GEOM" type="GEOMETRY(Point, 4326)">
         <constraints nullable="false" />
      </column>
   </createTable>
</changeSet>

<changeSet id="Create spatial index" author="bob">
   <preConditions>
      <not>
         <spatial:spatialIndexExists tableName="EXAMPLE" columnNames="GEOM" />
      </not>
   </preConditions>
   <spatial:createSpatialIndex tableName="EXAMPLE" indexName="EXAMPLE_GEOM_IDX" geometryType="Point" srid="4326">
      <column name="GEOM" />
   </spatial:createSpatialIndex>
</changeSet>

<changeSet id="Insert spatial data" author="bob">
   <insert tableName="EXAMPLE">
      <column name="ID" valueNumeric="1" />
      <column name="GEOM" value="SRID=4326;POINT(-5 -5)" />
   </insert>
   <insert tableName="EXAMPLE">
      <column name="ID" valueNumeric="2" />
      <column name="GEOM" value="SRID=4326;POINT(0 0)" />
   </insert>
   <insert tableName="EXAMPLE">
      <column name="ID" valueNumeric="3" />
      <column name="GEOM" value="SRID=4326;POINT(5 5)" />
   </insert>
</changeSet>

Refer to the documentation for further information.

Versions

Version
1.2.1
1.2.0
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0