From: Brenda Wallace Date: Wed, 10 Mar 2010 08:54:30 +0000 (+1300) Subject: primary keys and unique indexes working in postgres X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7398353c441699acc8b6ed38e221e40e30196208;p=quix0rs-gnu-social.git primary keys and unique indexes working in postgres --- diff --git a/lib/pgsqlschema.php b/lib/pgsqlschema.php index a4ebafae4b..8252419023 100644 --- a/lib/pgsqlschema.php +++ b/lib/pgsqlschema.php @@ -171,12 +171,10 @@ class PgsqlSchema extends Schema } if (count($primary) > 0) { // it really should be... - $sql .= ",\nconstraint primary key (" . implode(',', $primary) . ")"; + $sql .= ",\n primary key (" . implode(',', $primary) . ")"; } - foreach ($uniques as $u) { - $sql .= ",\nunique index {$name}_{$u}_idx ($u)"; - } + foreach ($indices as $i) { $sql .= ",\nindex {$name}_{$i}_idx ($i)"; @@ -184,6 +182,10 @@ class PgsqlSchema extends Schema $sql .= "); "; + + foreach ($uniques as $u) { + $sql .= "\n CREATE index {$name}_{$u}_idx ON {$name} ($u); "; + } $res = $this->conn->query($sql); if (PEAR::isError($res)) {