Generating Migration Scripts

From ADempiere ERP Wiki
Jump to navigationJump to search

Installation[edit]

  • Already in ADempiere since Release 3.3.1
  • Before Adempiere 3.3.1 you need to execute the script

034_message_logmigrationscript.sql

Configuration[edit]

Nothing required

Development[edit]

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

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 Adempiere will generate the files with migration scripts in the temp directory of your machine: in Windows Vista:

C:\Users\Carlos\AppData\Local\Temp\migration_script_postgresql.sql
C:\Users\Carlos\AppData\Local\Temp\migration_script_oracle.sql
in Windows XP
H:\Documents and Settings\user\Local Settings\Temp\migration_script_postgresql.sql
H:\Documents and Settings\user\Local Settings\Temp\migration_script_oracle.sql

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_COUNT=

INSERT, DELETE OR UPDATE ON THE FOLLOWING TABLES:
   AD_ACCESSLOG
   AD_ALERTPROCESSORLOG
   AD_CHANGELOG
   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_REPLICATION_LOG
   AD_SCHEDULERLOG
   AD_SESSION
   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