Quantcast
Channel: Liquibase Forums
Viewing all 1169 articles
Browse latest View live

Re : How do I get Liquibase to print out the SQL it generated?


Drop-create data after each test with SpringLiquibase

$
0
0

I'm using Springliquibase 3.3.2. I read the datas for db in csv files.

I have unit tests running with SpringLiquibase and I wanted the database returned to it's initial state after each test run.

I'm setting dropFirst == true and was expecting this to restore the hsql db but it does not. I see data changes in one test that were performed in previous tests. My code to define the SpringLiquibase :

@Configuration

@EnableJpaRepositories(basePackages={"my.package"})
@EntityScan(basePackages={"my.package"})
@EnableTransactionManagement
public class DatabaseConfiguration implements EnvironmentAware {
private RelaxedPropertyResolver propertyResolver;
 
private Environment env;
 
private DataSource dataSource;
private SpringLiquibase springLiquibase;
 
@Autowired(required = false)
private MetricRegistry metricRegistry;
 
@Override
public void setEnvironment(Environment env) {
    this.env = env;
    this.propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
}
 
@Bean(destroyMethod = "shutdown")
@ConditionalOnMissingClass(name = "fr.ticks.pp.front.config.HerokuDatabaseConfiguration")
@Profile("!" + "cloud")
public DataSource dataSource() {
    log.debug("Configuring Datasource");
    if (propertyResolver.getProperty("url") == null && propertyResolver.getProperty("databaseName") == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                "cannot start. Please check your Spring profile, current profiles are: {}",
                Arrays.toString(env.getActiveProfiles()));
 
        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariConfig config = new HikariConfig();
    config.setDataSourceClassName(propertyResolver.getProperty("dataSourceClassName"));
    if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) {
        config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName"));
        config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName"));
    } else {
        config.addDataSourceProperty("url", propertyResolver.getProperty("url"));
    }
    config.addDataSourceProperty("user", propertyResolver.getProperty("username"));
    config.addDataSourceProperty("password", propertyResolver.getProperty("password"));
 
    if (metricRegistry != null) {
        config.setMetricRegistry(metricRegistry);
    }
 
    dataSource = new HikariDataSource(config);
    return dataSource;
}
 
@Bean
public SpringLiquibase liquibase(DataSource dataSource) {
    SpringLiquibase liquibase = new SpringLiquibase();
    liquibase.setDataSource(dataSource);
    liquibase.setChangeLog("classpath:config/liquibase/master.xml");
    liquibase.setContexts("development, production");
    // ne lance liquibase que si on utilise H2 en mémoire
    boolean runningH2 = isRunningH2();
    liquibase.setShouldRun(runningH2);
    if (runningH2) {
        log.debug("Configuring Liquibase for H2");
    }
 
    return liquibase;
}

And my test file :

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest
public abstract class AbstractPPTest
{
 
  @Autowired
  protected ApplicationContext applicationContext;
 
  protected MockWebServiceClient mockClient;
 
  @Before
  public void initMock()
  {
    assertNotNull(applicationContext);
    mockClient = MockWebServiceClient.createClient(applicationContext);
    testDate = Calendar.getInstance();
  }
 
@Test
public void test
{
...
}


Is there a non-manual (or manual) way to reset the data between tests in test files ?

Thanks

Inheritable contexts

$
0
0
I've created a pull request for an older feature request that will make it possible for change sets to inherit contexts from the databaseChangeLog, include and includeAll elements. I think this will help productivity as the number of change logs and change sets increases. I'm looking for feedback. Thank you.

Cannot pass property using -Dproperty=value

$
0
0
When I try to run Liquibase on the command line passing a property using the -D switch I always get an error:

  1. liquibase -Dtable_owner=foo --defaultsFile=connection.properties --changeLogFile=changelog.xml update

results in the error:

Errors:
  Unexpected value -Dtable_owner=foo: parameters must start with a '--'

Usage: java -jar liquibase.jar [options] [command]
(Needless to say that --Dtable_owner=foo doesn't work either)

When I try the -D at the end of the line (as shown here)

  1. liquibase --defaultsFile=connection.properties --changeLogFile=changelog.xml update -Dtable_owner=foo

I get the error:


Unexpected error running Liquibase: Unknown parameter: 'table_owner'

SEVERE 11/3/15 10:41 AM: liquibase: Unknown parameter: 'table_owner'
liquibase.exception.CommandLineParsingException: Unknown parameter: 'table_owner'
        at liquibase.integration.commandline.Main.parsePropertiesFile(Main.java:453)
        at liquibase.integration.commandline.Main.run(Main.java:159)
        at liquibase.integration.commandline.Main.main(Main.java:99)


What am I missing?
I am using Liquibase 3.4.1

How do I pass a parameter (that is used with "${table_owner}" in the changeLog) on the command line?


Re : Cannot pass property using -Dproperty=value

$
0
0
I think you need to specify the parameters after the "update" command, so:

  1. liquibase --defaultsFile=connection.properties --changeLogFile=changelog.xml update -Dtable_owner=foo

Re : Cannot pass property using -Dproperty=value

$
0
0
Thanks for the answer. I did try that and also got an error - but that was unrelated to my commandline. My properties file contained a line "table_owner: foo" which caused the error. Passing -D after the update command indeed does work.

Sorry for the noise.

Re : Can I add changelog property to liquibase.properties file?

$
0
0
I had the same requirement, and after looking at the source code, I found out that this is possible if the property key is prefixed with "parameter":

  1. #Liquibase.properties
  2. driver: oracle.jdbc.OracleDriver
  3. classpath: ojdbc7.jar
  4. url: jdbc:oracle:thin:@10.0.2.1:1521:mydb
  5. username: USER
  6. password: pswd
  7. parameter.connection_string: user/pswd@mydb

Liquibase problems with converting TINYINT(1) to BIT

$
0
0
Deciding to treat TINYINT as BIT seems not to be working.

Liquibase: Data truncation: Data too long for column 'LOCKED' at row 1 [Failed SQL: INSERT INTO hgigoc.databasechangeloglock (ID, LOC
KED, LOCKGRANTED, LOCKEDBY) VALUES ('1', '0', NULL, NULL)]

Please, review the idea of treating TINYINT as BIT since all it acomplishes is making problems.

Liquibase unknown database error.

$
0
0
Hi ,

I am using liquibase 3.4.1 but I got one issue regarding database , my database  name is combination of small & capital letters.
While running liquibase update it is showing unknown database error . It converts all letters into small case. We are using
mysql database server. 

Following is the error log

DEBUG 26/11/15 3:08 PM: liquibase: Release Database Lock
DEBUG 26/11/15 3:08 PM: liquibase: Executing UPDATE database command: UPDATE myTestDB.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 26/11/15 3:08 PM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: java.sql.SQLException: Unknown database 'mytestdb'

SEVERE 26/11/15 3:08 PM: liquibase: java.sql.SQLException: Unknown database 'mytestdb'
liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: java.sql.SQLException: Unknown database 'mytestdb'
at liquibase.changelog.StandardChangeLogHistoryService.init(StandardChangeLogHistoryService.java:102)
at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1074)
at liquibase.Liquibase.update(Liquibase.java:203)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.integration.commandline.Main.doMigration(Main.java:1096)
at liquibase.integration.commandline.Main.run(Main.java:180)
at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: liquibase.exception.DatabaseException: java.sql.SQLException: Unknown database 'mytestdb'
at liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:78)
at liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData.getTables(JdbcDatabaseSnapshot.java:343)
at liquibase.snapshot.jvm.TableSnapshotGenerator.snapshotObject(TableSnapshotGenerator.java:32)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:194)
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:70)
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:44)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:21)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:158)
at liquibase.snapshot.SnapshotGeneratorFactory.getDatabaseChangeLogTable(SnapshotGeneratorFactory.java:165)
at liquibase.changelog.StandardChangeLogHistoryService.init(StandardChangeLogHistoryService.java:100)
... 6 more
Caused by: java.sql.SQLException: Unknown database 'mytestdb'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2370)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1183)
at com.mysql.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:3351)
at liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData$4.fastFetchQuery(JdbcDatabaseSnapshot.java:365)
at liquibase.snapshot.ResultSetCache$SingleResultSetExtractor.fastFetch(ResultSetCache.java:290)
at liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:58)
... 30 more
Please can someone help me ?

slash / after plsql block in sql script included by sqlFile tag

$
0
0
A lot of tools like Toad generates pl/sql scripts with slash after pl/sql blocks. But liquibase adds ; after slash and after compilation object is invalid. Shouls I always manually remove slash? Is there a better way?

Re : How to add JSONB columns for PostgreSQL?

$
0
0
Just use jsonb as the type:

  1. <column name="doc" type="jsonb"/>

Re : slash / after plsql block in sql script included by sqlFile tag

$
0
0
The following works fine for me:

* only put one procedure into one SQL file.
* end the procedure definition with a / on a single line.

Then use the <sqlFile> tag to run the script and define the proper endDelimiter:

  1.     <sqlFile path="create_proc.sql"
                 relativeToChangelogFile="true"
                 stripComments="false"
                 splitStatements="true" endDelimiter="\n/" />    

Note the definition of the endDelimiter: a new line followed by a forward slash.

If you do want to keep multiple PL/SQL CREATE statements in a single file, then use

  1. endDelimiter="\n/\n"

together with splitStatements="true". I think that works fine as well. But I haven't used that for ages.




includeAll not working for multimodule project with spring

$
0
0
As in title. If i place changelogs in module different than the one launched with application context includeAll is not working when i run application from jar file. Everything works fine if i run application normally (by maven command not jar file). Or put chagelogs in module with spring application context.


Module2 is starting module with application context, i'm using spring boot for running application. Module1 is child of module2 in other words module2 includes the first one. I'm using most recent version of liquibase core namely 3.4.2

Here is application context
  1. <bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase">
    <property name="dataSource" ref="dataSource"/>
    <property name="changeLog" value="classpath:db-changelog.xml" />
    </bean>

And master changelog

Maybe I would explain it better by directory structure.

 Not working directory structure
      .
      ├── Module1
      │   ├── src
      │   │   └── main
      │   │       └── resources
      │   │           ├── db-changelog.xml
      │   │           └── sql
      │   │               ├── 001-test.sql
      │   │               └── 002-test.sql
      │   └── target
      │       ├── classes
      │       │   ├── db-changelog.xml
      │       │   └── sql
      │       │       ├── 001-test.sql
      │       │       └── 002-test.sql
      │       └── Module1-1.0-SNAPSHOT.jar
      |
      └─ Module2
         ├── src
         │   └── main
         │       └── resources
         │           ├── applicationContext.xml
         │           └── mybatis-config.xml
         └── target
             ├── classes
             │   ├── applicationContext.xml
             │   └── mybatis-config.xml
             └── Module2-1.0-SNAPSHOT.jar
   
INFO 30.11.15 01:05: liquibase: Successfully acquired change log lock
WARNING 30.11.15 01:05: liquibase: included file classpath:db-changelog.xml/ is not a recognized file type
Working
   
      .
      ├── Module1
      │   ├── src
      │   │   └── main
      │   │       └── resources
      │   └── target
      │       ├── classes
      │       │   ── oceniarka
│   └── Module1-1.0-SNAPSHOT.jar │ └── Module2    ├── src    │   └── main    │      └── resources    │      ├── applicationContext.xml    │      ├── db-changelog.xml    │      ├── mybatis-config.xml    │      └── sql    │      ├── 001-test.sql    │          └── 002-test.sql    └── target    ├── classes    │   ├── applicationContext.xml    │   ├── db-changelog.xml    │   ├── mybatis-config.xml    │   └── sql    │   ├── 001-test.sql    │   └── 002-test.sql    └── Module2-1.0-SNAPSHOT.jar
INFO 30.11.15 01:14: liquibase: Successfully acquired change log lock
WARNING 30.11.15 01:14: liquibase: included file classpath:db-changelog.xml/ is not a recognized file type
INFO 30.11.15 01:14: liquibase: Reading from oceniarka.DATABASECHANGELOG
INFO 30.11.15 01:14: liquibase: classpath:db-changelog.xml: sql/002-test.sql::raw::includeAll: Custom SQL executed
INFO 30.11.15 01:14: liquibase: classpath:db-changelog.xml: sql/002-test.sql::raw::includeAll: ChangeSet sql/003-test.sql::raw::includeAll ran successfully in 17ms

This happens for reading sql or xml files both. Problem exists only for running application from jar. I would classify this as a bug because spring properly recognize db-changelog.xml in other module, but master changelog cannot reference sql directory with "include all". I think this is happens because liquibase use some module relative variable for recognizing path.Referencing files from another module by including one-by-one ("include file" instead "includeAll") works fine. I would be very grateful for fixing the bug or some workaround. Also sorry for my english and formatting (it looks like i seriously messed up something in html  ).

Re : Liquibase unknown database error.

$
0
0
Several databases do things like that - automatically convert the case of all table names, etc. written to the database to either uppercase or lowercase, and then similarly convert queries to all uppercase or lowercase. But they typically also support a mode where you quote the names, which prevents the names from being converted, and can prevent queries from working as a human might expect. 

The basic rule with these kinds of databases is that if you use quotes when creating the table/column/etc., then you must also use quotes and the same case when querying. For example, if you created the database named "MyTestDB" with quotes and mixed case, then querying for mytestdb (all lower case) will not work. 

To provide the correct quoting behavior for Liquibase, you can use the  objectQuotingStrategy="QUOTE_ALL_OBJECTS" attribute on your changeSet attribute or on the databaseChangeLog root element to override the default logic of "only quote objects that have to be"

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Liquibase unknown database error.

$
0
0

 Several databases do things like that - automatically convert the case of all table names, etc. written to the database to either uppercase or lowercase
This is required by the SQL standard: unquoted identifiers have to be stored in uppercase and they have to be case-insensitive.



Unable to generate offline migration script for PostgreSQL database

$
0
0
Hi

I would like to use Liquibase to generate offline SQL migration scripts for one of my projects and have encountered an issue when creating scripts for PostgreSQL databases.

The entry in the plugins section of my POM file is as follows:
  1. <plugin>
  2.     <groupId>org.liquibase</groupId>
  3.     <artifactId>liquibase-maven-plugin</artifactId>
  4.     <version>3.4.2</version>
  5.     <executions>
  6.         <execution>
  7.             <id>liquibase-postgresql-offline</id>
  8.             <configuration>
  9.                 <changeLogFile>src/main/resources/liquibase/db-changelog-master.xml</changeLogFile>
  10.                 <url>offline:postgresql?changeLogFile=${project.build.directory}/liquibase/postgresql/changelog.csv</url>
  11.                 <migrationSqlOutputFile>${project.build.directory}/liquibase/postgresql/migrate.sql</migrationSqlOutputFile>
  12.                 <outputFileEncoding>UTF-8</outputFileEncoding>
  13.             </configuration>
  14.             <phase>process-resources</phase>
  15.             <goals>
  16.                 <goal>updateSQL</goal>
  17.             </goals>
  18.         </execution>
  19.     </executions>
  20. </plugin>
The error returned by Maven is as follows:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.4.2:updateSQL (liquibase-postgresql-offline) on project cobalt-database-resource: Execution liquibase-postgresql-offline of goal org.liquibase:liquibase-maven-plugin:3.4.2:updateSQL failed: Failed to get current schema: Cannot execute commands against an offline database -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.4.2:updateSQL (liquibase-postgresql-offline) on project cobalt-database-resource: Execution liquibase-postgresql-offline of goal org.liquibase:liquibase-maven-plugin:3.4.2:updateSQL failed: Failed to get current schema
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution liquibase-postgresql-offline of goal org.liquibase:liquibase-maven-plugin:3.4.2:updateSQL failed: Failed to get current schema
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.RuntimeException: Failed to get current schema
at liquibase.database.core.PostgresDatabase.getConnectionSchemaName(PostgresDatabase.java:255)
at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:302)
at liquibase.changelog.ChangeLogParameters.<init>(ChangeLogParameters.java:54)
at liquibase.Liquibase.<init>(Liquibase.java:104)
at org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo.createLiquibase(AbstractLiquibaseChangeLogMojo.java:81)
at org.liquibase.maven.plugins.LiquibaseUpdateSQL.createLiquibase(LiquibaseUpdateSQL.java:56)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:360)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
... 20 more
Caused by: liquibase.exception.DatabaseException: Cannot execute commands against an offline database
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:73)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:117)
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:128)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:136)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:151)
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146)
at liquibase.database.core.PostgresDatabase.getConnectionSchemaName(PostgresDatabase.java:250)
... 27 more

I'm able to use offline mode to generate migration SQL scripts for other databases without a problem. I'm also able to do an online migration for PostgreSQL, so the problem seems to be unique to PostgreSQL in offline mode.

Is there something different I need to do to generate offline scripts for PostgreSQL?

Kind Regards

Paul

Re : Unable to generate offline migration script for PostgreSQL database

$
0
0
It appears that this is a bug in the liquibase.database.core.PostgresDatabase class. Most of the other implementations of getConnectionSchemaName() in the Database classes start with a check for an offline connection and return null. 

I have submitted a pull request to fix this - https://github.com/liquibase/liquibase/pull/533

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

New utility for testing your Liquibase changelog using H2 and JUnit

$
0
0
Hi everyone!

Some time ago I release an initial version of a new JUnit @Rule that makes it easier to test your DB integration code by setting up an in-memory H2 database to use in your test (see https://github.com/zapodot/embedded-db-junit for more details)..

Guess what? I just added a Liquibase initialization plugin that enables you to run apply your Liquibase change log to the embedded database before running your test code.
Look at this blog post for further details..

Comments and/or suggestions for further development are more than welcome :-)

Sondre

GitHub: zapodot
Twitter: @zapodot

SQL scripts should have "USE " in the header on SQL Server

$
0
0
Hello,

there is a ticket for this topic https://liquibase.jira.com/browse/CORE-2451. This was merged and released in 3.4.1, but I think this should be optional.

We use Liquibase to generate SQL and we don't know the target database name and we don't have execution of SQL under control. We only have copy of database which we use to generate SQL scripts and we keep it in sync.

So my goal is to remove "USE [database]", because it is integrator responsibility to run thw script under right database.

Any idea how to live with this. Ok, I can remove it from SQL script manually, but...

Thanks to all

Michael

Liquibase spring bean "log" property

$
0
0
Hi,

I've currently managed to configure my Spring application to work with liquibase in a way that it runs the update command whenever I start the application. The problem is that I'd like to be able to see the output log from liquibase in a different file in order to be able to clearly see what has happened to my database, without having to search the entire startup log that can get really big in size. Could you explain a bit how the "log" property of the spring bean works? 

Currently I have in my log4j.properties file a line like this:
      log4j.appender.liquibase=org.apache.log4j.RollingFileAppender
and I would like to use this as my default liquibase logger.
Any help or insight on this matter?

Thanks in advance.
Viewing all 1169 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>