Opened 13 years ago

Closed 13 years ago

#583 closed enhancement (fixed)

DB creation and migration configuration

Reported by: fxp Owned by: geonetwork-devel@…
Priority: major Milestone: v2.7.0
Component: General Version:
Keywords: Cc:

Description

Right now db creation and migration are based on file and directory naming conventions (eg. 2.6.0-to-2.7.0).

The improvement consists of:

  • create a file config-db.xml which defines what are the SQL file needed for each db tasks:
    <tasks>
     <create>
       <file path="WEB-INF/classes/setup/sql/create" filePrefix="db-"/>
       ...
     </create>
     <data>
       <file path="WEB-INF/classes/setup/sql/data" filePrefix="data-"/>
       ...
     </data>
     <migrate>
       <file path="WEB-INF/classes/setup/sql/migrate" filePrefix="270" version="270"/>
     </migrate>
    </tasks>
    

In this configuration file, we could:

  • have a set of sql files to run for each task so we could for example:
    • separate all language specific files (for easier maintenance - or load only required files) :
         <file path="WEB-INF/classes/setup/sql/create" filePrefix="data-"/>
         <file path="WEB-INF/classes/setup/sql/create" filePrefix="loc-en-"/>
         <file path="WEB-INF/classes/setup/sql/create" filePrefix="loc-fr-"/>
      
    • separate all migrations scripts :
        <sql path="WEB-INF/classes/setup/sql/migrate" filePrefix="263"
      version="263"/>
        <sql path="WEB-INF/classes/setup/sql/migrate" filePrefix="264"
      version="264"/>
      
  • order of file element will be important (run in tag order)
  • keep the mechanism to use the db type to look for SQL files and if not found use the "default"

For the migration, we could check the db version, webapp version, remove the "." to convert "2.7.0" in 270 and then run all migration scripts between db and webapp version so we will have only one migration script per version instead of a combination of source-to-destination scripts (which is hard to maintain).

This config-db.xml could be altered on startup by the config overrides mechanism (see #513).

Attachments (1)

583-conf-and-launch.patch (18.6 KB ) - added by fxp 13 years ago.

Download all attachments as: .zip

Change History (2)

by fxp, 13 years ago

Attachment: 583-conf-and-launch.patch added

comment:1 by fxp, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.