diff --git a/src/Phinx/Db/Adapter/PostgresAdapter.php b/src/Phinx/Db/Adapter/PostgresAdapter.php index 788c0b8a8..959d610c7 100644 --- a/src/Phinx/Db/Adapter/PostgresAdapter.php +++ b/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -1023,7 +1023,7 @@ protected function getIndexSqlDefinition(Index $index, $tableName) ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''), $indexName, $this->quoteTableName($tableName), - implode(',', $index->getColumns()) + implode(',', array_map(array($this, 'quoteColumnName'), $index->getColumns())) ); return $def; } diff --git a/tests/Phinx/Db/Adapter/PostgresAdapterTest.php b/tests/Phinx/Db/Adapter/PostgresAdapterTest.php index bccdfab1b..0e971cb3d 100644 --- a/tests/Phinx/Db/Adapter/PostgresAdapterTest.php +++ b/tests/Phinx/Db/Adapter/PostgresAdapterTest.php @@ -511,6 +511,17 @@ public function testAddIndex() $this->assertTrue($table->hasIndex('email')); } + public function testAddIndexIsCaseSensitive() + { + $table = new \Phinx\Db\Table('table1', array(), $this->adapter); + $table->addColumn('theEmail', 'string') + ->save(); + $this->assertFalse($table->hasIndex('theEmail')); + $table->addIndex('theEmail') + ->save(); + $this->assertTrue($table->hasIndex('theEmail')); + } + public function testDropIndex() { // single column index