Permalink
Browse files

[postgresql] raise error if migration table does not exist

  • Loading branch information...
1 parent c5867d1 commit d4019d9bf63d5d73bbca30222f51c71a1fa72c63 Schakko committed Mar 4, 2013
@@ -27,14 +27,20 @@ class DBInterface {
def lines = executor.exec_command(sql_latest_migration).split("\n")
def _major = '0', _minor = '0'
- if (lines.size() >= 4) {
- if (!lines[0].matches(/\s+$sql_major_col\s+\|\s+$sql_minor_col\s+/)) {
- throw new FilterException()
+ if (lines.size() > 0) {
+ if (lines.join(" ").toLowerCase().matches(/(.*)error(.*)/)) {
+ throw new Exception(lines.join(" "))
}
- lines[2].find(/\s+(\d*)\s+\|\s+(\d*)\s*/){ match, major, minor ->
- _major = major
- _minor = minor
+ if (lines.size() >= 4) {
+ if (!lines[0].matches(/\s+$sql_major_col\s+\|\s+$sql_minor_col\s+/)) {
+ throw new FilterException()
+ }
+
+ lines[2].find(/\s+(\d*)\s+\|\s+(\d*)\s*/){ match, major, minor ->
+ _major = major
+ _minor = minor
+ }
}
}
@@ -86,7 +86,7 @@ class Executor {
if (proc.exitValue() > 0) {
if (err)
- throw new Exception(e.getMessage() + ": " + err)
+ throw new Exception(e.getMessage() + ": " + err)
else
throw new Exception(e.getMessage() + ": Command did not exit normal but although did not return any error text. Is the executed command correct? Normal text stream follows:" + text)
}

0 comments on commit d4019d9

Please sign in to comment.