Re : Liquibase modify dbchangelog table
Preconditions column exists
Using liquibase 3.4.1 I want to rename my columns in Oracle to uppercase if they exist. I always get the following error no matter what I do:
Unexpected error running Liquibase: ORA-00957: duplicate column name
[Failed SQL: ALTER TABLE "SYSTEM"."MYTABLE" RENAME COLUMN "id" TO "ID"]
My precondition looks like this:
<changeSet author="sake" id="gfdgfd" dbms="oracle" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<preConditions onFail="MARK_RAN" >
<columnExists tableName="MYTABLE" columnName="id" />
</preConditions>
<renameColumn tableName="MYTABLE" oldColumnName="id" newColumnName="ID"/>
</changeSet>
I tried following: - removing objectQuotingStrategy - adding SQL check:
<sqlCheck expectedResult="1">
SELECT COUNT(*) FROM USER_TAB_COLUMNS
WHERE TABLE_NAME='MYTABLE'
AND COLUMN_NAME='id'
</sqlCheck>
Any idea why this happens? :/
Password encryption in Liquibase properties file
Re : Password encryption in Liquibase properties file
Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/
While executing the liquibase script, how to print the comment the one which is defined in the above changeset ?
<comment>Test comments 1</comment>
</changeSet>
</databaseChangeLog>
While executing the liquibase script, how to print the comment the one which is defined in the above changeset ?
Silently stopping Liquibase at mid-update
Is there any way I can cancel a Liquibase update after I started it?
I've a list with around 5000 changesets, and I need to prevent all changesets from a specific point forward, to not be executed if a specific condition occurs in one of those scripts.
Since putting <preConditions> in all of the existing scripts, and to all the new ones that will be created until the end of days, is not a doable approach, I was looking into an alternative and already tried the following:
- Created a <customChange> and throw an exception
- Created an invalid <sql> statement
- Added <stop/> in the <changeset>
All cases work, but they also throw thousands of log lines (that I can't have), because I need a silent stop.
Translator from MySQL to liquibase
Re : While executing the liquibase script, how to print the comment the one which is defined in the above changeset ?
Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/
Re : Translator from MySQL to liquibase
Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/
Liquibase java not applying changesets
- Connection c = null;
- Database database = null;
- PrintWriter pw = null;
- File file = null;
- liquibase.Liquibase liquibase = null;
- contexts = db+"."+user;
- try {
- pw = new PrintWriter(new FileWriter(file));
- // Get connection
- c = SQLManager.getInstance().getConnection(db, user, passwd);
- // Get liquibase connection
- database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c));
- liquibase = new liquibase.Liquibase(new DatabaseChangeLog(fsource), new FileSystemResourceAccessor(),
- database);
- // Run liquibase action
- switch (realAction) {
- case Constants.LIQUIBASE_ACTION_FUTUREROLLBACKSQL:
- liquibase.futureRollbackSQL(pw);
- break;
- case Constants.LIQUIBASE_ACTION_UPDATESQL:
- liquibase.update(contexts, pw);
- break;
- case Constants.LIQUIBASE_ACTION_UPDATE:
- liquibase.update(contexts);
- if (!c.getAutoCommit())
- c.commit();
- break;
- default:
- throw new RuntimeException("Action not implemented");
- }
- pw.close();
- database.close();
- c.close();
- } catch (IOException | SQLException | LiquibaseException e) {
- throw new Exception(e.getMessage());
- } finally {
- if (c != null) {
- try {
- c.close();
- } catch (SQLException e) {
- throw new RuntimeException(e.getClass() + ": " + e.getMessage());
- }
- }
- }
Re : Preconditions column exists
Re : Silently stopping Liquibase at mid-update
Re : Liquibase java not applying changesets
Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/
dropAll fails when tables have child partitions - postgres
Re : Translator from MySQL to liquibase
Re : Silently stopping Liquibase at mid-update
I already have lots of small changesets. Don't understand exactly your suggestion here.Or is there no way to break your changelog into much smaller pieces? If you have to stop changesets from executing starting at some point, then you should have a way to create much smaller changelogs (with eventually one big changelog composed with includes).
Re : Silently stopping Liquibase at mid-update
I already have lots of small changesets. Don't understand exactly your suggestion here.
Re : Translator from MySQL to liquibase
Re : Silently stopping Liquibase at mid-update
Then I execute a query to check for the specific condition, and if everything run ok, I create another dynamic changelog file with the remaining changelogs.
Re : [SOLVED] - Silently stopping Liquibase at mid-update
- You got your changesets in tiny changelog files.
- You include all these mini changelogs into an include changelog file generated dynamically at process start, which will include all the changesets created up to this day.
- You run the big file.