Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
Describe the issue:
SQL execution error occurs when try to migrate from 5.10 to 5.11-beta2 with H2.
How to reproduce:
Populate H2 using 5.10 with tenant, user add workflow and service providers.
Copy database files to 5.11-beta2
Migrate.
Expected behavior:
Successful migration from 5.10 to 5.11-beta2
Environment information (Please complete the following information; remove any unnecessary fields) :
Product Version: IS5.10.0, IS 5.11.0-beta2
OS: Ubuntu 18.04 LTS
Database: H2
Userstore: database_unique_id
Stack trace
ERROR {org.wso2.carbon.is.migration.service.SchemaMigrator} - Error occurred while executing SQL script for migrating database java.lang.Exception: Error occurred while executing : UPDATE idn_oauth_consumer_apps SET consumer_key= 'MY_ACCOUNT', callback_url = REPLACE(callback_url, 'user-portal/login', 'myaccount/login'), app_name = 'My Account' WHERE consumer_key = 'USER_PORTAL' AND tenant_id = -1234
at org.wso2.carbon.is.migration.service.SchemaMigrator.executeSQL(SchemaMigrator.java:303)
at org.wso2.carbon.is.migration.service.SchemaMigrator.executeSQLScript(SchemaMigrator.java:234)
at org.wso2.carbon.is.migration.service.SchemaMigrator.migrate(SchemaMigrator.java:89)
at org.wso2.carbon.is.migration.service.v5110.migrator.UserPortalDataMigrator.migrate(UserPortalDataMigrator.java:42)
at org.wso2.carbon.is.migration.VersionMigration.migrate(VersionMigration.java:52)
at org.wso2.carbon.is.migration.MigrationClientImpl.execute(MigrationClientImpl.java:76)
at org.wso2.carbon.identity.core.internal.IdentityCoreServiceComponent.activate(IdentityCoreServiceComponent.java:149)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:529)
at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:305)
at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:118)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)
Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Referential integrity constraint violation: "CONSTRAINT_5E3: PUBLIC.IDN_OIDC_PROPERTY FOREIGN KEY(CONSUMER_KEY) REFERENCES PUBLIC.IDN_OAUTH_CONSUMER_APPS(CONSUMER_KEY) ('USER_PORTAL')"; SQL statement:
UPDATE idn_oauth_consumer_apps SET consumer_key= 'MY_ACCOUNT', callback_url = REPLACE(callback_url, 'user-portal/login', 'myaccount/login'), app_name = 'My Account' WHERE consumer_key = 'USER_PORTAL' AND tenant_id = -1234 [23503-199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:457)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:427)
at org.h2.message.DbException.get(DbException.java:205)
at org.h2.message.DbException.get(DbException.java:181)
at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:373)
at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:400)
at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:265)
at org.h2.table.Table.fireConstraints(Table.java:1020)
at org.h2.table.Table.fireAfterRow(Table.java:1038)
at org.h2.command.dml.Update.update(Update.java:208)
at org.h2.command.CommandContainer.update(CommandContainer.java:133)
at org.h2.command.Command.executeUpdate(Command.java:267)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:233)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:205)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy55.execute(Unknown Source)
at org.wso2.carbon.is.migration.service.SchemaMigrator.executeSQL(SchemaMigrator.java:273)
... 33 more
Describe the issue: SQL execution error occurs when try to migrate from 5.10 to 5.11-beta2 with H2.
How to reproduce: Populate H2 using 5.10 with tenant, user add workflow and service providers. Copy database files to 5.11-beta2 Migrate.
Expected behavior: Successful migration from 5.10 to 5.11-beta2
Environment information (Please complete the following information; remove any unnecessary fields) :
Stack trace