DB migration issue

Description

Steps to reproduce:

  1. Restore Quesnelia BF dataSet(Okapi environment)

  2. Perform all required Infra changes(deploy kong, keycloak, BE modules with Sidecar and so on)

  3. Create tenants

  4. Prepare all required Eureka apps(full & consotia)

  5. Try to entitle consortia app on ECS tenants

  6. Receive error

[org.folio.rest_v2.eureka.kong.Tenants][ERROR] - Enabling application for tenant failed: [errors:[[message:Flow '5d593240-d8d0-49f2-981e-74a0c22b3fd9' finished with status: FAILED, type:FlowExecutionException, code:service_error, parameters:[[key:mod-consortia-keycloak-1.4.6-SNAPSHOT.96-folioModuleInstaller, value:FAILED: [IntegrationException] Failed to perform doPostTenant call, parameters: [{key: cause, value: 400: Liquibase error: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changes/migrate-data-from-mod-consortia.xml::EUREKA-65@@migrate-data-from-mod_consortia.tenant::yaroslavkiriak: Reason: liquibase.exception.DatabaseException: ERROR: column "setup_status" is of type setup_status but expression is of type cs00000int_mod_consortia.setup_status Hint: You will need to rewrite or cast the expression. Where: PL/pgSQL function inline_code_block line 7 at SQL statement [Failed SQL: (0) DO ' DECLARE BEGIN IF (EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema = ''cs00000int_mod_consortia'' AND table_name = ''tenant'')) THEN INSERT INTO cs00000int_mod_consortia_keycloak.tenant ( id, name, consortium_id, code, is_central, created_by, created_date, updated_by, updated_date, setup_status, is_deleted ) SELECT id, name, consortium_id, code, is_central, created_by, created_date, updated_by, (CASE WHEN updated_date IS NULL THEN created_date ELSE updated_date END) as updated_date, setup_status, is_deleted FROM cs00000int_mod_consortia.tenant; END IF; END; ' LANGUAGE plpgsql]}]]]]], total_records:1]

Please assists ASAP, this issue is the blocker for RANCHER-1735

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Attachments

5
  • 04 Oct 2024, 07:04 AM
  • 01 Oct 2024, 03:42 PM
  • 01 Oct 2024, 03:42 PM
  • 29 Sep 2024, 12:23 PM
  • 29 Sep 2024, 09:04 AM

Checklist

hide

Activity

Show:

Eldiiar Duishenaliev October 4, 2024 at 7:04 AM

Last changes seem to be fixing the original issue:

 

image-20241004-070340.png

Used version was complied from this branch:
folio-org/mod-consortia-keycloak at MODCONSKC-40-duplicate-pk_tenant_id (github.com)

Pushed to ECR and deployed to etesting-sprint environment 732722833398.dkr.ecr.us-west-2.amazonaws.com/mod-consortia-keycloak:latest

 



Eldiiar Duishenaliev October 1, 2024 at 3:42 PM

Last tests results:

{ "errors": [ { "message": "Flow '8aaa0ad4-a9fa-4e43-9a10-0bdbf08b98eb' finished with status: FAILED", "type": "FlowExecutionException", "code": "service_error", "parameters": [ { "key": "mod-consortia-keycloak-1.4.6-SNAPSHOT.96-folioModuleInstaller", "value": "FAILED: [IntegrationException] Failed to perform doPostTenant call, parameters: [{key: cause, value: 400: Liquibase error: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changes/migrate-data-from-mod-consortia.xml::EUREKA-65@@migrate-data-from-mod_consortia.tenant::yaroslavkiriak:\n Reason: liquibase.exception.DatabaseException: ERROR: duplicate key value violates unique constraint \"pk_tenant_id\"\n Detail: Key (id)=(cs00000int_0005) already exists.\n Where: SQL statement \"INSERT INTO cs00000int_mod_consortia_keycloak.tenant (\n id, name, consortium_id, code, is_central, created_by, created_date, updated_by, updated_date, setup_status, is_deleted\n ) SELECT\n id, name, consortium_id, code, is_central, created_by, created_date, updated_by,\n (CASE WHEN updated_date IS NULL THEN created_date ELSE updated_date END) as updated_date, setup_status::varchar, is_deleted\n FROM cs00000int_mod_consortia.tenant\"\nPL/pgSQL function inline_code_block line 7 at SQL statement [Failed SQL: (0) DO\n '\n DECLARE\n BEGIN\n IF (EXISTS (SELECT 1 FROM information_schema.tables\n WHERE table_schema = ''cs00000int_mod_consortia'' AND table_name = ''tenant''))\n THEN\n INSERT INTO cs00000int_mod_consortia_keycloak.tenant (\n id, name, consortium_id, code, is_central, created_by, created_date, updated_by, updated_date, setup_status, is_deleted\n ) SELECT\n id, name, consortium_id, code, is_central, created_by, created_date, updated_by,\n (CASE WHEN updated_date IS NULL THEN created_date ELSE updated_date END) as updated_date, setup_status::varchar, is_deleted\n FROM cs00000int_mod_consortia.tenant;\n END IF;\n END;\n ' LANGUAGE plpgsql]}]" } ] } ], "total_records": 1 }

 

image-20241001-154216.png

 

Eldiiar Duishenaliev September 29, 2024 at 12:23 PM

casting with :: operator works as presented on screenshot:

image-20240929-122339.png
Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Eureka

Fix versions

RCA Group

Lack of testing

Affected releases

Quesnelia (R1 2024)

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created September 29, 2024 at 9:06 AM
Updated November 1, 2024 at 5:43 AM
Resolved October 11, 2024 at 12:33 PM
TestRail: Cases
TestRail: Runs

Flag notifications