Generating Migration Scripts

From iDempiere en
Jump to navigation Jump to search
  • This feature is part of the Migration Feature in ADempiere 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. Please note this parameter 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 the needed dictionary objects and iDempiere will generate the files with migration scripts in the temp directory of your machine (i.e. /tmp on linux, some windows uses C:\Users\YourUser\AppData\Local\Temp, other windows uses C:\Documents and Settings\YourUser\Local Settings\Temp)

The migration generated script looks like this:

-- Nov 11, 2007 1:54:50 AM COT
-- FR 1829798 - Easy generation of migration scripts
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,53007,0,TO_DATE('2007-11-11 01:54:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Log Migration Script','Log Migration Script - Save migration scripts file in %TEMP%/migration_script_*.sql','I',TO_DATE('2007-11-11 01:54:49','YYYY-MM-DD HH24:MI:SS'),100,'LogMigrationScript')
;

-- Nov 11, 2007 1:54:50 AM COT
-- FR 1829798 - Easy generation of migration scripts
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53007 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;

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...

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_WINDOW_ACCESS
   AD_WORKFLOW_ACCESS
   AD_WORKFLOWPROCESSORLOG
   CM_WEBACCESSLOG
   C_ACCTPROCESSORLOG
   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