Commit 1ff9dedf by Alexander Makarov

Fixed getting default value from postgres schema

parent 2c4a6066
......@@ -373,6 +373,12 @@ SQL;
$table->sequenceName = preg_replace(['/nextval/', '/::/', '/regclass/', '/\'\)/', '/\(\'/'], '', $column->defaultValue);
}
}
if ($column->defaultValue) {
if (preg_match("/^'(.*?)'::/", $column->defaultValue, $matches) || preg_match("/^(.*?)::/", $column->defaultValue, $matches)) {
$column->defaultValue = $matches[1];
}
}
}
return true;
......@@ -398,7 +404,6 @@ SQL;
$column->precision = $info['numeric_precision'];
$column->scale = $info['numeric_scale'];
$column->size = $info['size'];
if (isset($this->typeMap[$column->dbType])) {
$column->type = $this->typeMap[$column->dbType];
} else {
......@@ -406,6 +411,7 @@ SQL;
}
$column->phpType = $this->getColumnPhpType($column);
return $column;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment