liquibase

Generate a database update scripts with Hibernate/Spring

随声附和 提交于 2019-12-04 17:59:33
问题 I have a project where we use to rely on hibernate to update database with changes (hibernate.hbm2ddl.auto=update)... even on prod... I am migrating that to use liquibase instead. My only concern is that not everyone is a sql guru in my team, so I am looking for a simple way to generate the sql script that hibernate would have done if it was updating the database. We are all using Intellij IDEA but couldn't find this feature. Do you know any tool capable of doing that? Thank you 回答1: To

liquibase <insert> : Insert current date

拟墨画扇 提交于 2019-12-04 15:08:18
问题 I am trying to insert data using liquibase insert tag. It works fine when I am inputing a number to value tag . But I am looking for a simple function that will take care of default date (current DateTime of database) even when I don't have it as part of my table definition. Eg: <changeSet id="abc_1" author="Me"> <insert tableName="Emp" schemaName="XYZ"> <column name="name" value="Me"/> <column name="create_date" value ="1328055111692"/> <column name="profile_last_update" value=

How to define in Liquibase a set of default columns, def. PKs, def. indexes, def. values for table creation?

别等时光非礼了梦想. 提交于 2019-12-04 12:32:43
I just looking around to reduce effort and errors on table creation on liquibase. Is it possible to create a set of default colums for tables? columns: int ID varchar UUID timestamp createdTs timestamp updatedTs int lockVersion constraints ID not NULL and with autogenerated key (as primary key) UUID not NULL createdTS not NULL with default CURRENT_TIMESTAMP updatedTS not NULL with default CURRENT_TIMESTAMP lockVersion not NULL index ID UUID so for example: genericTable.xml <changeSet author="me" id="myCsId"> <column name="id" type="int" /> <column name="uuid" type="varchar(255)" /> <column

LiquiBase — Any way to output change log sql to a file in 2.0.5?

旧城冷巷雨未停 提交于 2019-12-04 09:58:09
Currently I am integrating Liquibase with my spring application using liquibase.integration.spring.SpringLiquibase bean From java doc, tt is plausible to know there is an property sqlOutputDir to that bean class so that the sql can output to external file. However, the feature seems not exist in latest 2.0.5. So, the question is, what is the current equivalent method or function to output changeLog sql to external file, or the feature just have been totally removed forever? Please give a hint, thanks a lot. The equivalent Java command for writing the SQL output is: Liquibase#update(String,

Setting up Liquibase with MS-SQL Server

孤街醉人 提交于 2019-12-04 09:24:22
问题 I am utilising Liquibase (www.liquibase.org) into our MVC3 SQL Server 2008 project to manage database migration/changes. However I'm stumbling on the first hurdle: Connecting to Microsoft SQL Server instance. I am looking at the quick start tutorial on the liquibase site, but exchanging the mysql for sql server DB I run this command: liquibase --driver=sqljdbc.jar --changeLogFile="C:\Temp\ChangeLog.xml" --url="jdbc:sqlserver://localhost;databaseName=test" --username=user --password=pass

List all liquibase sql types

筅森魡賤 提交于 2019-12-04 07:39:29
问题 I try to find documentation on the supported types that can be used in change log files. But cannot find it. Is there any document, site or something similar where I can find all types-specific issues. For example clob type is supported in databases with different types. And I have to use something like: <property name="clob.type" value="clob" dbms="oracle,h2,hsqldb"/> <property name="clob.type" value="longtext" dbms="mysql"/> <column name="clob1" type="${clob.type}"> <constraints nullable=

Can you clear liquibase checksums for a given file only?

烂漫一生 提交于 2019-12-04 04:04:21
Running liquibase --url=jdbc:oracle:thin:@localhost:1521/XE -- driver=oracle.jdbc.OracleDriver --changeLogFile=db.changelog-next.xml -- username=owner --password=xxxx --logLevel=info clearCheckSums clears ALL checksums from the database. Is there a way to clear only the checksums for changesets in db.changelog-next.xml. Thanks I don't think there is another command or a parameter to clearCheckSums that does this. But you could do this manually. All that clearCheckSums does is nullifying the MD5SUM column of the databasechangelog table. So something like: update databasechangelog set md5sum

liquibase:diff not giving me expected result

天大地大妈咪最大 提交于 2019-12-04 02:25:42
问题 I have a JPA entity called customer and goes like this @Entity public class Customer { private int custNo; private String custName; private String country; public Customer() { } public Customer(int custNumber, String custName, String country) { this.custNo = custNumber; this.custName = custName; this.country = country; } public int getCustNo() { return custNo; } public void setCustNo(int custNo) { this.custNo = custNo; } public String getCustName() { return custName; } public void setCustName

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

那年仲夏 提交于 2019-12-03 23:19:18
问题 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

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

﹥>﹥吖頭↗ 提交于 2019-12-03 22:36: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