diff options
author | Brenda Wallace <shiny@cpan.org> | 2010-03-10 21:54:30 +1300 |
---|---|---|
committer | Brenda Wallace <shiny@cpan.org> | 2010-03-10 21:54:30 +1300 |
commit | 7398353c441699acc8b6ed38e221e40e30196208 (patch) | |
tree | 6a705d2fc96e54a14c98159963c3d4f7f070fa76 /lib | |
parent | c4ee2b20bee567e1c41888bb46bfc8d5f98e8951 (diff) |
primary keys and unique indexes working in postgres
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pgsqlschema.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pgsqlschema.php b/lib/pgsqlschema.php index a4ebafae4..825241902 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)) { |