New column in Openbravo ERP prone to merge conflicts

October 3, 2008

Recently I’ve added to AD_Column table in Openbravo ERP database the Position column and I’ve commited it to trunk (r8191). This new column stores the physical database order for the columns which will be required by Data Access Layer Project.

This column is mandatory, so when mergeing trunk to project branches it will cause problems in case these projects add new columns. Here I will try to explain who to deal with these problems:

  • First of all resolve the conflicts as usual in the xml files.
  • If you have created new columns in your project you will not be able to update your database, so before updating let’s put the new column as not mandatory open src-db/database/model/tables/AD_COLUMN.xml file and change the line <column name="POSITION" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"> to <column name="POSITION" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false">. Now you should be able to update your database.
  • Your database now contains the columns you’ve added to your project with the position value as null, now you have to populate this value to do it execute:

UPDATE AD_COLUMN C
SET POSITION=(SELECT COLUMN_ID FROM USER_TAB_COLUMNS U, AD_TABLE T
WHERE T.AD_TABLE_ID = C.AD_TABLE_ID
AND TABLE_NAME = UPPER(T.TABLENAME)
AND COLUMN_NAME = UPPER(C.COLUMNNAME))
WHERE POSITION IS NULL;

  • Export now your database to xml files.
  • Revert the previous modification in src-db/database/model/tables/AD_COLUMN.xml file.
  • And now you are ready to commit

Entry Filed under: Openbravo. Tags: , .

1 Comment Add your own

  • 1. Michael Tim  |  February 28, 2009 at 19:21

    I love your site!

    _____________________
    Experiencing a slow PC recently? Fix it now!

    Reply

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Archives

Tags

branches build process developers utilities documentation Java mercurial modularity r2.50 scm subversion UUID

Blog Stats