Browse Source

Fixes #1096: pgsql: sequence name not matched

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
bd82170142
  1. 2
      framework/yii/db/pgsql/Schema.php

2
framework/yii/db/pgsql/Schema.php

@ -281,7 +281,7 @@ SQL;
$table->columns[$column->name] = $column;
if ($column->isPrimaryKey === true) {
$table->primaryKey[] = $column->name;
if ($table->sequenceName === null && preg_match("/nextval\('\w+'(::regclass)?\)/", $column->defaultValue) === 1) {
if ($table->sequenceName === null && preg_match("/nextval\\('\"?\\w+\"?'(::regclass)?\\)/", $column->defaultValue) === 1) {
$table->sequenceName = preg_replace(['/nextval/', '/::/', '/regclass/', '/\'\)/', '/\(\'/'], '', $column->defaultValue);
}
}

Loading…
Cancel
Save