I have 3 components and some are working and some not.
- Accounting 2) Inventorycontrol 3) AccountsReceivable
While Accounting is component of Inventorycontrol, it’s working well and i am able to use the Entity created in Accounting into Inventorycontrol.
However, when I am using those three components into another project salesorder, database update is giving exception for the duplicate entity in one of the component as below. I took the following steps in application component:
- add component descriptor
- Run application server
- Install app component
I also tried like this sequence:
1.Clean, assembly
2. recreate component descriptor
3. Install app component
BUILD SUCCESSFUL
Total time: 2.395 secs
[15:43:19.671] Stopping Gradle daemon
[15:43:24.272] Stopping daemon(s).
Gradle daemon stopped.
[15:43:24.273] Running 'install' task
:inventorycontrol-core:assembleDbScripts UP-TO-DATE
:inventorycontrol-core:dbScriptsArchive UP-TO-DATE
Used all 3 app component in another project. The entities are available in this project but couldn’t update the database for the entities i created in this main project, got the following exception: The you will see the message below appears to be related a to an entity that is created in in component project and used (Association) in the main application.
[15:54:58.906] Updating database jdbc:postgresql://localhost/myms
:myemsso-core:assembleDbScripts
:myemsso-core:updateDb
Script 50-myemsic/init/postgres/10.create-db.sql has not been applied, running init scripts
Executing SQL script: D:\Studio Projects\ems\myemsso\modules\core\build\db\50-myemsic\init\postgres\10.create-db.sql
Failed to execute: -- begin MYEMSIC_MATERIAL
create table MYEMSIC_MATERIAL (
ID uuid,
VERSION integer not null,
CREATE_TS timestamp,
CREATED_BY varchar(50),
UPDATE_TS timestamp,
UPDATED_BY varchar(50),
DELETE_TS timestamp,
DELETED_BY varchar(50),
--
DOC_NUMBER bigint,
NAME varchar(255),
SPECIFICATION varchar(255),
UNIT_OF_MEASURE_ID uuid,
MATERIAL_GROUP_ID uuid,
MATERIAL_TYPE varchar(50),
--
primary key (ID)
) because: ERROR: relation "myemsic_material" already exists
Failed to execute: insert into SYS_DB_CHANGELOG (SCRIPT_NAME, IS_INIT) values (?, ?) because: ERROR: duplicate key value violates unique constraint "sys_db_changelog_pkey"
Detail: Key (script_name)=(50-myemsic/update/postgres/16/161014-1-createMaterial.sql) already exists.
:myemsso-core:updateDb FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myemsso-core:updateDb'.
> org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "sys_db_changelog_pkey"
Detail: Key (script_name)=(50-myemsic/update/postgres/16/161014-1-createMaterial.sql) already exists.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 10.994 secs
[15:55:11.164] Task 'updateDb' failed
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "sys_db_changelog_pkey"
Detail: Key (script_name)=(50-myemsic/update/postgres/16/161014-1-createMaterial.sql) already exists.
Note that the Entity Material is existing in Inventorycontrol component and not created in the main app. What could be the reason causing this error and the fix?