missing column 'CONTEXTS' after Liquibase migration to version 3.4.0 from 2.0.4 - liquibase

I try to migrate Liquibase from old version 2.0.5 to 3.4.0. The first thing I tried was the status command, what resulted in a problem reading the table 'databasechangelog':
Error executing SQL SELECT
FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,EXECTYPE,DESCRIPTION,COMMENTS,TAG,LIQUIBASE,LABELS,CONTEXTS
FROM IDENTSERVICE.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC,
ORDEREXECUTED ASC: ORA-00904: "CONTEXTS"
I seems the are two new columns in the table: LABELS and CONTEXTS
The Lquibase website told it is just a drop-in replacement.
So my question: Do I need to go fist to version 3.0.0, or how do I get the new columns? Manual manipulation is not a option.

Checkout the ´StandardChangeLogHistoryService´ class.
Search for hasContexts e.g. There is code that checks if those columns are there.
So if the test for the column CONTEXTS fails there should be a log line that says:
"Adding missing databasechangelog.contexts column".
You can check you log for this.
So, yes it is supposed to be a drop-in replacement.

The solution is not running the status command but the update command that worked well.
Be careful, you can not go back to the old version of Liquibase. The old version thows checksum errors.

Related

How do I specify validchecksum to any in liquibase formatted sql?

I have run into an issue with liquibase. So , I made a mistake in my sql commands in one of the changesets. Now whenever I try to upgrade my deployment , the upgrade is failing due to wrong checksum.
So I thought of doing the validCheckSum : ANY workaround and have run into this issue where it is not working. So my question is , is there any mistake in my syntax and How do I bypass the checksum check or what is the proper syntax for setting any in liquibase formatted sql.
This is what I have tried
--changeset darth: build-1.3
--validCheckSum: build-1.3:ANY
and it doesnt work.
Please help! Thanks!
The docs say:
Special value "1:any" will match to any checksum
Not sure why did you put "build-1.3:ANY"?
Also what you can do is:
Execute your code with latest liquibase changes onto an empty database
In DATABASECHANGELOG table look for the rows with changeset ids that you have been changing
Copy the MD5SUM value and paste it into your changeSet definition as a value of validCheckSum
It should run on any database with already executed changesets without errors.
It is worth mentioning that altering a change set is not recommended: by setting a validCheckSum value you will have "old" changeset already executed and "new" changes to this change set will be skiped. On an empty database your "new" changeset will be executed, so you will potentially have model inconsistencies.

Error - mismatched input 'SWAP' expecting 'REROUTE' in CrateDB for Alter Cluster query

I am upgrading CRATE DB from version 2.x to 3.1.6 as per suggestion when I try to upgrade tables created in version 2.x using document,
https://crate.io/docs/crate/reference/en/latest/admin/system-information.html#tables-need-to-be-upgraded
In step 5,
Query -
alter CLUSTER SWAP table transactions2 to transactions;
I am getting error SQLActionException[SQLParseException: line 1:15: mismatched input 'SWAP' expecting 'REROUTE']
I am not sure what would be the correct query to resolve this.
You are following the latest documentation instead of the e.g. 2.3 (https://crate.io/docs/crate/reference/en/2.3/admin/system-information.html#tables-need-to-be-recreated) documentation version.
The SWAP SQL command support was added in version 3.2, see https://crate.io/docs/crate/reference/en/latest/appendices/release-notes/3.2.0.html#database-administration.

SSIS error in Data Flow Task with Dynamic connection

I have very basic skills in developing SSIS packages; and getting errors while developing this new package. With this package, the SQLInstance is getting determined fine as can be seen in column mapping in the second picture. But it is not reading columns from the columns of a user table (IndexType column, in this case). This is the issue.
Tried below steps with no luck till now:
I set the VaidateExternalMetaData setting to False, still same error.
Already removed all columns one-by-one to identify whether it is issue with some specific data type, still same issue.
Created a brand new test package, same error in test package also.
Another package working fine in production with same settings with a user database. Copied the DataFlowTask component from it and used it new package, still same issue.
Please help. Many thanks.
It may be SQL server version. I had similar issue when using table variables or temp tables. You need to use with result set, similar to this:
EXEC('SELECT 43112609 AS val;')
WITH RESULT SETS
(
(
val VARCHAR(10)
)
);
Article here:
http://www.itprotoday.com/sql-server-2012-t-sql-glance-execute-result-sets
SQL can not tell what is being returned when using temp/table variablbes so you have to specify this. It is needed for some versions of SQL Server.

Bad changelog from generateChangeLog with MariaDB

I am attempting to generate a change log against a MariaDB server. I am able to successfully generate a change log, however if I do a dropAll and update to validate that it is useful, there are multiple problems with it. I have tried using both the native mariadb and MySQL jdbc connectors and both experience these problems. I am also using liquibase 3.1.1.
The first is that there are deferrable and initiallyDeferred flags which are not supported by MySQL. The update command specifically calls these out as being invalid flags against MySQL.
Once I remove all of those references in the .xml, attempting to update runs into a sql syntax error because a double datatype is defined as DOUBLE(22) (in the xml). This is not a valid syntax for a double in mariadb or MySQL. They accept no parameters, or DOUBLE(m,d); my database is defined as default (no parameters).
Now its trying to create a table with an auto_increment but not specifying that the column is also a key in the create table statement; ie. it's missing the primaryKey constraint.
And I'm sure there are more problems in line as I work my way through the changelog (this is just changeset 116 out of 1500+).
Its almost as if liquibase is creating the changelog based on it thinking the db is a different type (postgres/oracle?).
Am I missing something?
You are right, the problem is that Liquibase is thinking it is an unknown database and doesn't know it is almost mysql. There is an issue open to add mariaDB support (https://liquibase.jira.com/browse/CORE-1411) but it hasn't been implemented quite yet.
The easiest work-around would be to add an extension:
Create a new liquibase.database.ext.MariaDBDatabase class in your codebase that extends liquibase.database.core.MySQLDatabase and override the isCorrectDatabaseImplementation(DatabaseConnection conn) method that returns true if conn.getDatabaseProductName() equals whatever the MariaDB jdbc driver is returning.
You may also want to override the getDefaultDatabaseProductName() to return "mariadb" instead of MySQL so you can differentiate it with contexts

SQL code assist in IntelliJ IDEA

In IntelliJ IDEA 11.0.1 I connected Data Source to Oracle database.
When I open an *.sql file and type
SELECT * FROM
I see in code completion list of available tables. Also table columns of selected table are available in WHERE part of statement
But when I type
INSERT INTO
No table is available in code completion.
The same for SQL console.
Looks like a known bug. It's already fixed in IDEA 12 EAP and will be also fixed in IDEA 11.1.4 (not released at the moment of writing this answer).