mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-06 15:15:58 +00:00
Fix h2 migration
Using java source code obviously requires `javac` during migration.
This commit is contained in:
parent
2e443bc9b9
commit
177488817d
@ -1,12 +1,2 @@
|
|||||||
DROP ALIAS IF EXISTS CAST_TO_NUMERIC;
|
DROP ALIAS IF EXISTS CAST_TO_NUMERIC;
|
||||||
CREATE ALIAS CAST_TO_NUMERIC AS '
|
CREATE ALIAS CAST_TO_NUMERIC FOR "docspell.store.impl.h2.CastNumericFun.castToNumeric";
|
||||||
import java.text.*;
|
|
||||||
import java.math.*;
|
|
||||||
@CODE
|
|
||||||
BigDecimal castToNumeric(String s) throws Exception {
|
|
||||||
try { return new BigDecimal(s); }
|
|
||||||
catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package docspell.store.impl.h2
|
||||||
|
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
/** This is used from within the H2 database! */
|
||||||
|
object CastNumericFun {
|
||||||
|
def castToNumeric(str: String): BigDecimal =
|
||||||
|
try new BigDecimal(str)
|
||||||
|
catch {
|
||||||
|
case _: Throwable => null
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user