Generating Migration Scripts

From iDempiere en
  • This feature is part of the Migration Feature in iDempiere to allow complete facilitation of distributing changes from one user to another easily and efficiently.
  • Implemented as FR 1829798 in changeset a375f3d3e67f
  • See also: Centralized_ID_Management

Configuration

Nothing required

Development

When you're ready to develop a trunk enhancement, bug or feature request that requires migration scripts, you need to open a session and check the flag "Log Migration Script" in Preferences window. You can fill there the "Migration Script Comment" that will appear on top of the migration script as a reference.

Please note this preference is not saved between sessions - so you need to check it any time you are going to develop something new for the trunk:

01 GeneratingMigrationScripts.png

This can be combined with "Dictionary Maintenance" to generate official migration scripts, or used alone to generate customization migration scripts.

After this you just continue creating/updating the needed dictionary objects and iDempiere will generate the files with migration scripts in the current migration folder of your machine (f.e. migration/iD10/), most of the times the migration scripts are set in the migration folder ready to be added to a commit.

The migration generated script looks like this:

-- IDEMPIERE-5409 Dashboard Content - Maximizable checkbox
SELECT register_migration_script('202209061547_IDEMPIERE-5409.sql') FROM dual;

-- Sep 6, 2022, 3:47:13 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203651,0,0,'Y',TO_TIMESTAMP('2022-09-06 15:47:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-09-06 15:47:13','YYYY-MM-DD HH24:MI:SS'),100,'IsMaximizable','Is Maximizable','Is Maximizable','D','250c4f55-23e9-48d7-b5b4-0154ecf8b52a')
;

-- Sep 6, 2022, 3:48:41 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215283,0,'Is Maximizable',50010,'IsMaximizable','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-09-06 15:48:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-09-06 15:48:40','YYYY-MM-DD HH24:MI:SS'),100,203651,'Y','N','D','N','N','N','Y','afa27a31-f8f8-4bc4-a734-b136e430793a','Y',0,'N','N','N','N')
;

-- Sep 6, 2022, 3:50:01 PM CEST
ALTER TABLE PA_DashboardContent ADD COLUMN IsMaximizable CHAR(1) DEFAULT 'Y' CHECK (IsMaximizable IN ('Y','N')) NOT NULL
;

IMPORTANT NOTE: POSSIBLE PROBLEM: Even failed SQL statements are being logged.
Developer must review carefully the generated migration script for possible problems before committing.


Please note also these statements are not being logged:

SELECT
UPDATE AD_PROCESS SET STATISTIC_...
UPDATE C_ACCTPROCESSOR SET DATENEXTRUN...
UPDATE R_REQUESTPROCESSOR SET DATELASTRUN...
UPDATE AD_SEQUENCE SET CURRENTNEXT...
DELETE FROM ... WHERE AD_TABLE_ID=? AND RECORD_ID=?
UPDATE ..._TRL SET ...
INSERT INTO ... _TRL ...
INSERT INTO AD_TREENODE ... AND T.TREETYPE='TL' AND T.AD_TABLE_ID=

INSERT, DELETE OR UPDATE ON THE FOLLOWING TABLES:
   AD_ACCESSLOG
   AD_ALERTPROCESSORLOG
   AD_CHANGELOG
   AD_DOCUMENT_ACTION_ACCESS
   AD_FORM_ACCESS
   AD_INFOWINDOW_ACCESS
   AD_ISSUE
   AD_LDAPPROCESSORLOG
   AD_PACKAGE_IMP
   AD_PACKAGE_IMP_BACKUP
   AD_PACKAGE_IMP_DETAIL
   AD_PACKAGE_IMP_INST
   AD_PACKAGE_IMP_PROC
   AD_PINSTANCE
   AD_PINSTANCE_LOG
   AD_PINSTANCE_PARA
   AD_PREFERENCE
   AD_PROCESS_ACCESS
   AD_RECENTITEM
   AD_REPLICATION_LOG
   AD_SCHEDULERLOG
   AD_SESSION
   AD_USERPREFERENCE
   AD_WINDOW_ACCESS
   AD_WLISTBOX_CUSTOMIZATION
   AD_WORKFLOW_ACCESS
   AD_WORKFLOWPROCESSORLOG
   C_ACCTPROCESSORLOG
   CM_WEBACCESSLOG
   K_INDEXLOG
   R_REQUESTPROCESSORLOG
   T_AGING
   T_ALTER_COLUMN
   T_DISTRIBUTIONRUNDETAIL
   T_INVENTORYVALUE
   T_INVOICEGL
   T_REPLENISH
   T_REPORT
   T_REPORTSTATEMENT
   T_SELECTION
   T_SELECTION2
   T_SPOOL
   T_TRANSACTION
   T_TRIALBALANCE
Cookies help us deliver our services. By using our services, you agree to our use of cookies.