...
Panel | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
October 19, 2014 | 1.0.0 |
|
November 6, 2014 | 1.1.0 |
|
July 26, 2015 | 1.1.1 |
|
April 2, 2016 | 1.2.0 | |
September 13, 2016 | 1.2.1 | |
December 18, 2016 | 1.3.0 |
|
Attachments |
---|
Readme
Supported Databases
...
- Liquibase 3.2.0 (liquibase-percona 1.0.0)
- Liquibase 3.3.0 (liquibase-percona 1.1.1)
- Liquibase 3.3.5 and 3.4.2 (liquibase-percona 1.2.1)
- Liquibase 3.3.5, 3.4.2, and 3.5.3 (liquibase-percona 1.3.0)
Supported Changes and examples
...
pt-online-schema-change --alter="ADD COLUMN address VARCHAR(255)" ...
AddForeignKeyConstraint
Since: liquibase-percona 1.3.0
Automatic rollback supported? yes
Example:
<changeSet id="3" author="Alice">
<addForeignKeyConstraint constraintName="fk_person_address"
referencedTableName="person" referencedColumnNames="id"
baseTableName="address" baseColumnNames="person_id"/>
</changeSet>
Corresponding command:
pt-online-schema-change --alter="ADD CONSTRAINT fk_person_address FOREIGN KEY (person_id) REFERENCES person (id)" ...
AddUniqueConstraint
Since: liquibase-percona 1.3.0
Automatic rollback supported? yes
Example:
<changeSet id="2" author="Alice">
<addUniqueConstraint columnNames="id, name" tableName="person" constraintName="uq_id_name"/>
</changeSet>
Corresponding command:
pt-online-schema-change --alter="ADD CONSTRAINT uq_id_name UNIQUE (id, name)" ...
CreateIndex
Since: liquibase-percona 1.2.0
...
pt-online-schema-change --alter="DROP COLUMN age" ...
DropForeignKeyConstraint
Since: liquibase-percona 1.3.0
Automatic rollback supported? no
Example:
<changeSet id="4" author="Alice">
<dropForeignKeyConstraint baseTableName="address" constraintName="fk_person_address" />
</changeSet>
Corresponding command:
pt-online-schema-change --alter="DROP FOREIGN KEY _fk_person_address" ...
DropUniqueConstraint
Since: liquibase-percona 1.3.0
Automatic rollback supported? no
Example:
<changeSet id="3" author="Alice">
<dropUniqueConstraint tableName="person" constraintName="uq_id_name"/>
</changeSet>
Corresponding command:
pt-online-schema-change --alter="DROP KEY uq_id_name" ...
DropIndex
Since: liquibase-percona 1.2.0
...
pt-online-schema-change --alter="MODIFY email VARCHAR(400)" ...
Configuration
UsePercona flag
Each change allows to enable or disable the usage of percona toolkit via the property usePercona
. By default, the percona toolkit is used, see also the system property liquibase.percona.defaultOn
.
Example:
- changeSet:
id: 2
author: Alice
changes:
- addColumn:
tableName: person
usePercona: false
columns:
- column:
name: address
type: varchar(255)
This flag exists since liquibase-percona 1.3.0
It is currently only supported by using the YAML format.
System Properties
The extension supports the following java system properties:
liquibase.percona.failIfNoPT
: true/false. Default: false. If set to true, the database update will fail, if the commandpt-online-schema-change
is not found. This can be used, to enforce, that percona toolkit is used.liquibase.percona.noAlterSqlDryMode
: true/false. Default: false. When running updateSQL or rollbackSQL in order to generate a migration SQL file, the command line, that would be executed, will be added as a comment. In addition, the SQL statements (as produced by liquibase-core) will also be generated and output into the migration file. This allows to simply execute the generated migration SQL to perform an update. However, the Percona toolkit won't be used. If this property is set totrue
, then no such SQL statements will be output into the migration file.liquibase.percona.skipChanges
: comma separated list of changes. Default: <empty>. This option can be used in order to selectively disable one or more changes. If a change is disabled, then the change will be executed by the default liquibase core implementation and percona toolkit won't be used. By default, this property is empty, so that all supported changes are executed using the percona toolkit. Example: Set this toaddColumn,dropColumn
in order to not use percona for adding/dropping a column.liquibase.percona.options
: String of options. Default: <empty>.
This option allows the user to pass additional command line options to pt-online-schema-change. This e.g. can be used in complication replication setup to change the way slaves are detected and how their state is used. You can also specify a percona configuration file via--config file.conf
, see Configuration Files. Multiple options are separated by space. If argument itself contains a space, it must be quoted with double-quotes, e.g.--config "filename with spaces.conf
.liquibase.percona.defaultOn
: true/false. Default: true. Since liquibase-percona 1.3.0 This options allows to change the default behavior for the UsePercona flag. By default, all changes, that do not explicitly specify this flag, use the value from this system property. Settings this property tofalse
allows to control for each single change, whether to use Percona Toolkit or not.
You can set these properties by using the standard java -D
option:
...
After extracting the zip file of liquibase, place liquibase-percona-1.23.10.jar
file in the sub directory lib
. The shell script liquibase
/ liquibase.bat
will automatically pick this up and the extension is available.
...
<dependency>
<groupId>com.github.adangel.liquibase.ext</groupId>
<artifactId>liquibase-percona</artifactId>
<version>1.23.1<0</version>
</dependency>
Using snapshots
...
And just use the latest SNAPSHOT version for liquibase-percona dependency, e.g. 1.23.21-SNAPSHOT
:
<dependency>
<groupId>com.github.adangel.liquibase.ext</groupId>
<artifactId>liquibase-percona</artifactId>
<version>1.23.21-SNAPSHOT</version>
</dependency>
...
See the properties config_... in pom.xml
for connection details for the mysql docker instance.
To run a single integration test, execute maven like this: mvn verify -Prun-its -Dinvoker.test=addColumn*,dropColumn
Common Problems
NoSuchMethodError: PerconaDropColumnChange.getColumns()Ljava/util/List
...