splitting flyway metatable schema_version and business data in two different databases possible? - flyway

It´s possible to configure flyway to use for the metatable (schema_version table) e.g. in PostgreSQL and for the migration scripts itself (mvn flyway:migrate) in another target database e.g. DB2?
The background of my question:
Flyway don´t support DB2 z/OS. My idea was, flyway should track the history on PostgreSQL and migration itself on DB2 z/OS.
At the moment when i use DB2 z/OS i get this error:
FlywaySqlException:
[ERROR] Error retrieving the database user
[ERROR] ----------------------------------
[ERROR] SQL State : 26501
[ERROR] Error Code : -514
[ERROR] Message : DB2 SQL Error: SQLCODE=-514, SQLSTATE=26501, SQLERRMC=SQL_CURLH200C1, DRIVER=3.61.75
[ERROR] : DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=CURRENT_USER, DRIVER=3.61.75
[ERROR] -> [Help 1]
CURRENT_USER exists only in DB2 LUW variant.
Any workarounds or solution?

Related

Liquibase with Maven using Teradata

I am getting the following error, while running the command: mvn liquibase:update
liquibase.exception.databaseexception:connection could not be created to jdbc:teradata://org.sys.db.com/database=sample_DEV with driver com.teradata.jdbc.TestDriver [Teradata Database] [Terajdbc 16.20.00.00] [Error] [SQLState HY000] Logons are only enabled for user DBC.
We are using maven version:3.6.3, Liquibase version:4.3.0 and teradata ver:16.20.00.00 with dbchangelog.sql
The same code is working fine for nornal project, i mean without maven.
"com.teradata.jdbc.TestDriver" is not the class name for the Teradata JDBC Driver. The actual class name is "com.teradata.jdbc.TeraDriver".
Version 16.20.00.00 of the Teradata JDBC Driver was not released to the public. That was a pre-release build.
You can download the current supported version of the Teradata JDBC Driver from here:
https://downloads.teradata.com/download/connectivity/jdbc-driver
Here is a link to the Teradata documentation for database error 3055 "Logons are only enabled for user DBC."
https://docs.teradata.com/r/GVKfXcemJFkTJh_89R34UQ/Si5mPxDLg2vugG5MnDbBoQ

In Corda, schema cannot be cast to net.corda.core.schemas.MappedSchema exception

I am trying to create migration schemas for a CorDapp as per the instructions here. I am running the following command:
java -jar corda-tools-database-manager-3.1.jar
--base-directory /opt/User
--create-migration-sql-for-cordapp fnolUseCase.state.FNOLSchema
However, I am getting the following error:
-- 2018-08-22T13:29:23,145Z migration.tool.invoke - Creating database migration
files for schema: fnolUseCase.state.FNOLSchema into /opt/User/migration
Failed to create datasource.
Please check that the correct JDBC driver is installed in one of the following
folders:
- /opt/User/drivers
Caused By java.lang.ClassCastException: fnolUseCase.state.FNOLSchema cannot be cast
to net.corda.core.schemas.MappedSchema
What should I be doing differently?
It seems to be having trouble locating your fnolUseCase.state.FNOLSchema class. Try dropping the schema name from the end of your command. This will cause a migration schema to be created for every schema in your application:
java -jar corda-tools-database-manager-3.1.jar
--base-directory /opt/User
--create-migration-sql-for-cordapp fnolUseCase.state.FNOLSchema

Flyway - Cant run Multiple sql Scripts

My files - V3.2-alter.sql and V3.2-3insert_fmcc.sql
If i am running flyway - i get error ..
[ERROR] Failed to execute goal
org.flywaydb:flyway-maven-plugin:3.2.1:migrate (default) on project
SnapdealOPS: org.flywaydb.core.api.FlywayException: Found more than
one migration with version 3.2 Offenders:
[ERROR] ->
/home/kartikeya/git/SnapdealOPS/MySQLDB/release-V3.2/V3.2-1alter.sql
(SQL) [ERROR] -> /home/kartikeya/git/SnapdealOPS/MySQLDB/release-
V3.2/V3.2-3insert_fmcc.sql (SQL)
Cant i run multiple sql scripts for single version . Do i have to put all the queries in single file .
If you want two files, you need to give them two versions (like 3.2.0.0.1 and 3.2.0.0.2). That is how the order of application is defined.

How to fake flyway migration?

Two of us made a migration script in different GIT branches. Now, I've pulled origin development branch, and I've corrected GIT merge issues, and renamed my migration script to be the last. So, the new initialization of DB and migration of DB from version of develop branch would be fine.
However, I've got a lot of data in my local testing DB, so I've manually applied new migration scripts that I've pulled in GIT. However, I can't make flyway think, that everything is okay.
So, How can I fake migrations?
When I try to migrate, I get following error:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:3.2.1:migrate (default-cli) on project db: org.flywaydb.core.api.FlywayException: Validate failed. Migration Description mismatch for migration 1.118
[ERROR] -> Applied to database : AAA
[ERROR] -> Resolved locally : BBB
[ERROR] -> [Help 1]
You will have to manually update Flyway's metadata table (called schema_version by default)

flywaydb : MView Refresh Failing

I am trying to refresh Materialised view using Flyway DB but below error coming
Help....is this supported or not?
Below SQL
ALTER MATERIALIZED VIEW TEST.TBL_M_V REFRESH COMPLETE ON DEMAND;
EXECUTE DBMS_MVIEW.REFRESH('TEST.TBL_M_V','C');
ALTER MATERIALIZED VIEW TEST.TBL_M_V NEVER REFRESH;
Below error coming
ERROR: Migration of schema "TEST" to version 4.1 failed! Please restore backu
ps and roll back database and code!
ERROR:
Migration V4_1__MViewRefresh_Test.sql failed
--------------------------------------------------
SQL State : 42000
Error Code : 900
Message : ORA-00900: invalid SQL statement
Location : C:/dev/flyway-3.1/sql/V4_1__MViewRefresh_Test.sql
Line : 8
Statement : EXECUTE DBMS_MVIEW.REFRESH('TEST.TBL_M_V','C')
As the error says, it is not a Flyway issue. The Oracle JDBC driver refused your statement.
This is the correct syntax you should use:
BEGIN
DBMS_MVIEW.REFRESH('TEST.TBL_M_V','C');
END;

Resources