Browse Source

Fixed getting default value from postgres schema

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
1ff9dedf60
  1. 8
      framework/db/pgsql/Schema.php

8
framework/db/pgsql/Schema.php

@ -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;
}
}

Loading…
Cancel
Save