liquibase

Liquibase: How to set the default value of a date column to be “now” in UTC format?

本秂侑毒 提交于 2019-12-01 02:07:07
How do you set the default value of a date column to be "now" in UTC format? I think the answer involves the defaultValueComputed attribute on the column element . The documentation states: defaultValueComputed A value that is returned from a function or procedure call. This attribute will contain the function to call. What langauge is the function referred to supposed to be written in? Java? Is the function supposed to be the database vendor -specific date function I want to use? Is there any more documentation I can read on this topic? Maybe this topic in the liquibase forum will help? I

org.hsqldb.HsqlException: user lacks privilege or object not found: DATABASECHANGELOGLOCK

て烟熏妆下的殇ゞ 提交于 2019-12-01 01:33:17
How can this happen. Isn't liquibase supposed to create this table for itself... This is an in memory database created for unit testing. public void setUp(String contexts) { try { ResourceAccessor resourceAccessor = new FileSystemResourceAccessor(); Class.forName("org.hsqldb.jdbcDriver"); holdingConnection = getConnectionImpl(); HsqlConnection hsconn = new HsqlConnection(holdingConnection); liquibase = new Liquibase(CHANGE_LOG, resourceAccessor, hsconn); liquibase.dropAll(); liquibase.update(contexts); hsconn.close(); } catch (Exception ex) { LOG.error("Error during database initialization",

How to create database with Liquibase

旧巷老猫 提交于 2019-11-30 22:42:01
I am trying to use Liquibase to create database that does not exists. I have downloaded MySQL and not made any change in it My maven plugin code looks like <plugins> <plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <version>3.1.1</version> <configuration> <changeLogFile>src/main/resources/changelog.xml</changeLogFile> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://localhost:3306/myApp?createDatabaseIfNotExist=true</url> </configuration> <executions> <execution> <phase>process-resources</phase> <goals> <goal>update</goal> </goals> </execution>

Liquibase on multiple databases

半城伤御伤魂 提交于 2019-11-30 22:18:39
I have already implemented Liquibase with Maven. We are currently using a single database (db2) but now we need to add a new database to the application which will have different objects. I've seen that i can define a new profile in maven but i couldn't find out how to differentiate which objects is being created on which database. Is there a solution to this? Can I support 2 different databases with different objects using liquibase? You may want to have 2 separate changelogs to manage the two databases, even if they are both used by the same application. Arturo Volpe As you can see in the

Does Liquibase support dry run?

冷暖自知 提交于 2019-11-30 20:15:10
We have couple of data schemas and we investigate the migration to Liquibase. (One of data schemas is already migrated to Liquibase). Important question for us is if Liquibase supports dry run: We need to run database changes on all schemas without commit to ensure we do not have problems. In case of success all database changes run once again with commit. (The question similar to this SQL Server query dry run but related to Liquibase) Added after the answer I read documentation related to updateSQL and it is not answers the requirements of “dry run”. It just generates the SQL (in command line

Create databases with liquibase on empty mysql instance

旧街凉风 提交于 2019-11-30 19:37:41
I have fresh mysql instance and want to be able to create a plenty of databases and populate it with liquibase. While I have scripts (changesets) which works fine on manually created databases I want to be able to create databases with liquibase as well. When I try to connect without specifing database in URL I've got the error: liquibase --driver=com.mysql.jdbc.Driver --url=jdbc:mysql://localhost:3306/ --username=root --password=admin --changeLogFile=create_dbs.sql tag empty Unexpected error running Liquibase: Incorrect database name '' [Failed SQL: CREATE TABLE ``.DATABASECHANGELOGLOCK (ID

How to configure liquibase not to include file path or name for calculating checksum?

对着背影说爱祢 提交于 2019-11-30 17:45:25
I found that liquibase uses the full path of the change log file to calculate the checksum. This behavior restricts to modify change log file names and tries to reapply the change sets again once renamed the file. Is there a way to configure liquibase to use only the changelog id to calculate cuecksum? Please provide your valuable thoughts. Use the attribute logicalFilePath of the databaseChangeLog tag. Upstream developers recommend use logicalFilePath and suggest to perform direct update on DATABASECHANGELOG.FILENAME column: http://forum.liquibase.org/topic/why-does-the-change-log-contain-the

Liquibase Command Line create diff changelog in sql

北城以北 提交于 2019-11-30 15:04:31
I actually use Liquibase on windows in command lines, and I try to create an sql script that represent the diff between two databases. Unfortunatly I only get xml file in return. Can you help me ? My command line : liquidbase.bat --driver=com.mysql.jdbc.Driver --url=jdbc:mysql://localhost:3306/base1 --username=root diffChangeLog --referenceUrl=jdbc:mysql://localhost:3306/base2 --referenceUsername=root > test.sql I've seen this similar question in an other forum but he didn't got a good answer ( http://forum.liquibase.org/topic/convert-changelog-xml-file-into-sql-file ). I've also seen some

Liquibase-hibernate changelog generation for entities in multiple schemas

对着背影说爱祢 提交于 2019-11-30 14:40:05
I am trying to generate diff between Hibernate entities (from a single base package) and a clean database (Oracle 11gR2 XE) through liquibase-maven-plugin using liquibase-hibernate5 (Spring-5.0.4.RELEASE, Hibernate-5.2.15.Final, JPA-2.1.1 application over servlet 3.1 with all (full) programmatic configuration). I am using JSON as change log format and liquibase-hibernate5 (v3.6) with liquibase-maven-plugin (v3.5.5). JPA specification version being used in the config is 2.1.1. Snippet from the POM: <plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId>

How to add new column with default value from existing column in Liquibase

最后都变了- 提交于 2019-11-30 09:18:00
I'm using Postgres DB and for migration I'm using Liquibase. I have an ORDERS table with the following columns: ID | DATE | NAME | CREATOR | ... I need to add a new column which will hold the user who has last modified the order - this column should be not-nullable and should have default value which is the CREATOR. For new orders I can solve the default value part of the business logic, but thing is I already have an existing orders and I need to set the default value when I create the new column. Now, I know I can set a hard-coded default value in Liquibase - but is there a way I could add