History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: UNI-170
Type: Improvement Improvement
Status: Closed Closed
Resolution: Won't Fix
Priority: Minor Minor
Assignee: Unassigned
Reporter: dom farr
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Unitils

Use reg expression to harvest the number for indexing scripts.

Created: 29/Sep/09 01:35 PM   Updated: 07/Nov/09 08:55 PM
Component/s: dbmaintainer
Affects Version/s: 2.0, 1.1
Fix Version/s: 3.0

File Attachments: 1. Text File Script.java.patch (0.5 kb)
2. Java Source File ScriptTest.java (1 kb)

Environment: all


 Description  « Hide
Method:
Long org.unitils.dbmaintainer.script.Script.extractIndex(String pathPart)

The version, or index, of a script is determined by splitting the file name at the underscore (if exists) in the extractIndex method of Script.

In current project we forgot the requirement to use underscore and started using hyphen to delimit the script index and name. This coincidentally worked for almost 3 months, until it didn't :) and tracking problem down lead to this request.

Use reg expression to harvest the number, if available.

 All   Comments   Change History      Sort Order:
dom farr - 29/Sep/09 01:35 PM
This is the patch file for the change.

dom farr - 29/Sep/09 01:37 PM
Here is the test case for using regular expression to harvest the index from the file name for the patch to extractIndex method in Script

dom farr - 29/Sep/09 01:50 PM
that would be led, not lead(Pb) the soft dense metallic element. :)

Filip Neven - 07/Nov/09 08:55 PM
We'd like to impose the filename format, since in the future we will support more advance features such as qualifiers in the filename.

E.g.
05_#refdata_#patch_addstatuscol.sql

-> contains 2 qualifiers: refdata + patch.

Implementing this with regexp would get complicated. A solution that may be acceptable is to make the separator character configurable, but I'm not sure whether it's worth the extra complexity.

BTW. Updates to the dbmaintainer are now performed in the dbmaintain project. In the future dbmaintain will become a dependency of unitils.