Re : how can I run a set of changeSet in transaction
Manual Script execution
The liquibase.exception occurs during generateChangeLog when mssql constraint has comments
I created the TestDb on Microsoft SQL Server 2014, then I created the table
[Id] [uniqueidentifier] NOT NULL,
[Name] [nchar](10) NULL,
[Number] [int] NULL,
CONSTRAINT [PK_TestTable] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TestTable] ADD CONSTRAINT [DF_ConstraintName] DEFAULT ('No name') FOR [Name]
GO
After that I create
CREATE DEFAULT [dbo].[DefaultZeroValue]
AS
0
GO
and did
EXEC sp_bindefault 'DefaultZeroValue', 'TestTable.Number';
After all this, I did
liquibase --defaultsFile="test.prop" generateChangeLog
and I got newchangelog.mssql.sql with content
--liquibase formatted sql
--changeset TestDb:1510256718974-1
CREATE TABLE [TestTable] ([Id] [uniqueidentifier] NOT NULL, [Name] [nchar](10) CONSTRAINT [DF_TestTable_Name] DEFAULT 'No name', [Number] [int] CONSTRAINT [DF_TestTable_Number] DEFAULT create default DefaultZeroValue
as 0);
--changeset TestDb:1510256718974-2
ALTER TABLE [TestTable] ADD CONSTRAINT [PK_TestTable] PRIMARY KEY ([Id]);
But if I change the type of column Number from int to bit and do again sp_bindefault, then after executing
liquibase --defaultsFile="test.prop" generateChangeLog
I get the exception:
DEBUG 09.11.17 23:38: liquibase: Executing QUERY database command: SELECT CAST([ep].[value] AS [nvarchar](MAX)) AS [REMARKS] FROM [sys].[extended_properties] AS [ep] WHERE [ep].[class] = 1 AND [ep].[major_id] = OBJECT_ID(N'[dbo].[DATABASECHANGELOGLOCK]') AND [ep].[minor_id] = COLUMNPROPERTY([ep].[major_id], N'LOCKEDBY', 'ColumnId') AND [ep].[name] = 'MS_Description'
DEBUG 09.11.17 23:38: liquibase: Executing QUERY database command: SELECT CAST(value as varchar(max)) as REMARKS FROM sys.extended_properties WHERE name='MS_Description' AND major_id = OBJECT_ID('[dbo].[TestTable]') AND minor_id = 0
Unexpected error running Liquibase: liquibase.exception.DatabaseException: java.lang.NumberFormatException: For input string: "create default DefaultZeroValue as 0"
SEVERE 09.11.17 23:38: liquibase: liquibase.exception.DatabaseException: java.lang.NumberFormatException: For input string: "create default DefaultZeroValue as 0"
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException: For input string: "create default DefaultZeroValue as 0"
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:265)
at liquibase.integration.commandline.Main.doMigration(Main.java:1011)
at liquibase.integration.commandline.Main.run(Main.java:188)
at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException: For input string: "create default DefaultZeroValue as 0"
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:263)
... 3 more
Caused by: liquibase.exception.DatabaseException: java.lang.NumberFormatException: For input string: "create default DefaultZeroValue as 0"
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:129)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:73)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:246)
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:363)
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:385)
at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:293)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:267)
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:80)
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:53)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:28)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:139)
at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.java:219)
at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:141)
at liquibase.command.GenerateChangeLogCommand.run(GenerateChangeLogCommand.java:45)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
... 4 more
Caused by: java.lang.NumberFormatException: For input string: "create default DefaultZeroValue as 0"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.valueOf(Unknown Source)
at liquibase.util.SqlUtil.parseValue(SqlUtil.java:142)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readDefaultValue(ColumnSnapshotGenerator.java:491)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshotGenerator.java:273)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:123)
... 20 more
For more information, use the --logLevel flag
Please, help
Re : Future of Liquibase?
Hi,
It's always great to hear from people who find value in and who are actively using Liquibase. I can take a moment to provide some updates regarding the future plans for Liquibase.
To be fully transparent, as of late, I’ve been very committed to other projects and have not been able to make time to contribute to Liquibase. This isn’t how I want things to go, and I agree that updates on Liquibase are overdue. To directly address your question, we do have a plan to push out a release that includes a number of high value pull requests that are currently sitting in review. In all honesty, this is something that will be out early next year (likely in January) as I simply don’t have many spare cycles right now.
Going forward, I know that both myself and the broader team at Datical know we need to do more to keep the Liquibase project moving forward. It’s common for open source efforts to sometimes stagnate or slow, but we certainly don’t want things to come to a halt. As such, you can expect more active maintenance and involvement than there has been of late.
In regards to the the Datical fork, it's not really a fork but simply a branch which will get merged in when I get a chance to make sure it is does not include any changes that will adversely affect other Liquibase users. It will be brought in as part of the 3.6 release.
Lastly, we are spending some time thinking about how we can add more committers to the Liquibase project. When I do get busy, I don’t want to continue to be the sole bottleneck to progress on this project. I don’t have a vetted strategy yet, but I’d look to active, engaged members from the user community to step up and serve as committers. The DBManul merge was a good example of this where a community member was able to go through the work of testing and integrating a large set of pull requests that I was able to bring in a bundle. That was very helpful, but we need something more consistent and organized. As the project and community has grown over the years it has become well past time that I found ways to scale process of accepting pull requests.
Thanks again for being an active user for all these years. I appreciate you sticking with this project, and I hope that you (and others that a part of the Liquibase community) remain with us as we bring development of Liquibase back to a more predictable pace.
Nathan
Re : Future of Liquibase?
Re : Future of Liquibase?
Running custom extension in Liquibase -element is not bounded
Hi,
I am trying to write new extension using Liquibase performing the following steps:
1-Download Liquibase core project and configure it using eclipse
2-Create new Java project called custom-Liquibase which is depending on Liquibase core project
3-Create the following hierarchy structure \liquibase-custom\src\liquibase\ext\Vacuum (Taking this example from liqubase extension) Adding the following files:
VacuumChange.java
VacuumPostgres.java
VacuumStatement.java
4- Create the following hierarchy structure liquibase-custom\src\liquibase\parser\core\xml
dbchangelog-ext.xsd
<xsd:element name="vacuum">
<xsd:complexType>
<xsd:attribute name="tableName" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
5-create new custom jar from my project liquibase-custom.jar
6-Adding the following change sets to my mail changelog.xml
<changeSet id="1" author="nvoxland">
<createTable tableName="vacuumtest">
<column name="id" type="int"/>
<column name="name" type="varchar(50)"/>
</createTable>
</changeSet>
<changeSet id="2" author="nvoxland">
<vacuum:vacuum tableName="vacuumtest"/>
</changeSet>
7-Run Liquibase in the following mode by adding the new liquibase-custom.jar to my classpath:
java -jar liquibase.jar --driver=org.postgresql.Driver --classpath=lib/postgresql-42.1.4.jar;lib/liquibase-custom.jar --changeLogFile=sdk/workspace/changelog/com/example/changelog.xml --url="jdbc:postgresql://localhost:5432/Demo1" --username=postgres --password=1234 update
8-I am getting the error :
Unexpected error running Liquibase: The prefix "vacuum" for element "vacuum:vacuum" is not bound.
I will be happy to know if I missing something in the above steps, or maybe I am not working properly in the way custom change should be written
Thanks
Spool file creation
Liquibase 3.5 CORE-2553
does anyone know the syntax for disabling reorg statement when adding columns to a DB2 database tables (as described in liquibase v3.5 CORE-2553)
Re : Liquibase 3.5 CORE-2553
In each of the cases, you would set the property autoReorg to true or false. If you are running liquibase from the command line using liquibase.bat or liquibase.sh, you can either:
Cannot find database driver for Redshift
java -jar scripts/liquibase-core-3.3.3.jar
--username=root
--password="myfakepassword"
--url=jdbc:redshift://<redshift_path>.amazonaws.com:5439/dev
--changeLogFile=scripts/master.xml
--driver=lib/liquibase-redshift-1.0-SNAPSHOT.jar
--classpath=lib/liquibase-redshift-1.0-SNAPSHOT.jar
update
Getting error
Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: lib/liquibase-redshift-1.0-SNAPSHOT.jar
I tried multiple options under https://github.com/liquibase/liquibase-redshift/releases but did not work . All of them give the same error.
Is there something obvious I am missing?
Re : Cannot find database driver for Redshift
Does liquibase support PostgreSQL 10?
- url=jdbc:postgresql://localhost:5432/testdb
- driver=org.postgresql.Driver
- username=user
- password=pass
- [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:generateChangeLog (default-cli) on project test-project: Error setting up or running Liquibase: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: Error getting jdbc:postgresql://localhost:5432/testdb view with liquibase.statement.core.GetViewDefinitionStatement@fe34b86: Expected single row from liquibase.statement.core.GetViewDefinitionStatement@26bbe604 but got 0: Empty result set, expected one row -> [Help 1]
- ERROR: column i.indproc does not exist at character 610
- HINT: Perhaps you meant to reference the column "i.indpred".
- SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, ct.relname AS TABLE_NAME, NOT i.indisunique AS NON_UNIQUE, NULL AS INDEX_QUALIFIER, ci.relname AS INDEX_NAME, CASE i.indisclustered WHEN true THEN 1 ELSE CASE am.amname WHEN 'hash' THEN 2 ELSE 3 END END AS TYPE, a.attnum AS ORDINAL_POSITION, CASE i.indpred WHEN 0 THEN a.attname ELSE ip.proname || '(' || ai.attname || ')' END AS COLUMN_NAME, NULL AS ASC_OR_DESC, ci.reltuples AS CARDINALITY, ci.relpages AS PAGES, NULL AS FILTER_CONDITION FROM pg_class ct, pg_class ci, pg_attribute a, pg_am am, pg_attribute ai, pg_index i LEFT JOIN pg_proc ip ON (i.indpred = ip.oid) WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid AND a.attrelid=ci.oid AND ci.relam=am.oid AND ai.attnum = i.indkey[0] AND ai.attrelid = ct.oid AND ct.relname = 'sql_sizing_profiles' ORDER BY NON_UNIQUE, TYPE, INDEX_NAME, ORDINAL_POSITION;
Set search_path and not use public
--defaultSchemaName=my_db --defaultCatalogName=my_db
but did not help.
Any suggestions?
Liquibase spring weblogic support
- || file.matches("^.+:.+")
modified ClassLoaderResourceAccessor list method:
- if (!fileUrls.hasMoreElements() && (path.startsWith("jar:") || path.startsWith("file:"))) {
fileUrls = new Vector<URL>(Arrays.asList(new URL(path))).elements();
}
- if (!fileUrls.hasMoreElements() && (path.startsWith("jar:") || path.startsWith("file:")) || path.startsWith("zip:")) {
fileUrls = new Vector<>(Arrays.asList(new URL(path))).elements();
}
- JarFile zipfile = new JarFile(zipFilePath, false);
try {
Enumeration<JarEntry> entries = zipfile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.getName().startsWith(path)) {
- JarFile zipfile = new JarFile(zipFilePath, false);
String internalPath = zipAndFile[1];
try {
Enumeration<JarEntry> entries = zipfile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (("/"+entry.getName()).startsWith(internalPath)) {
mvn plugin not working
- liquibase:rollback -Dliquibase.rollbackTag=1.17
But maven responds me with this error:
- BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.516 s [INFO] Finished at: 2017-12-07T13:37:13-02:00 [INFO] Final Memory: 11M/155M [INFO] ------------------------------------------------------------------------ [ERROR] No plugin found for prefix 'liquibase' in the current project and in the plugin groups
- [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories
- [local (C:\Users\romulo\.m2\repository), central (https://repo.maven.apache.org/maven2)]
However i already inserted the plugin:here´s my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PlayManager_LiquiBase</groupId>
<artifactId>PlayManager_LiquiBase</artifactId>
<version>1.7.0</version>
<packaging>jar</packaging>
<name>PlayManager_LiquiBase</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.4.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.liquibase/liquibase-maven-plugin -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>liquibase.integration.commandline.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>PlayManager_LiquiBase</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
</project>What i´m doing wrong?
Re : mvn plugin not working
what is the default value for a column of type boolean which is nullable?
Can we Hadoop Hive Database?
addAutoIncrement does not work on Liquibase 3.5.3 for Postgres
