Commit 258bed32 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-148 - Foreign Key Creation

parent 0f3f8769
......@@ -1671,7 +1671,7 @@ abstract class AbstractPlatform
$sql .= implode(', ', $foreignKey->getLocalColumns())
. ') REFERENCES '
. $foreignKey->getForeignTableName() . '('
. $foreignKey->getForeignTableName() . ' ('
. implode(', ', $foreignKey->getForeignColumns()) . ')';
return $sql;
......
......@@ -138,7 +138,7 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
public function getGenerateForeignKeySql()
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table(id)';
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
public function testModifyLimitQuery()
......
......@@ -144,7 +144,7 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
public function getGenerateForeignKeySql()
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table(id)';
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
/**
......
......@@ -160,7 +160,7 @@ class OraclePlatformTest extends AbstractPlatformTestCase
public function getGenerateForeignKeySql()
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table(id)';
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
public function testModifyLimitQuery()
......
......@@ -46,7 +46,7 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
public function getGenerateForeignKeySql()
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table(id) NOT DEFERRABLE INITIALLY IMMEDIATE';
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE';
}
public function testGeneratesForeignKeySqlForNonStandardOptions()
......@@ -55,7 +55,7 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
array('foreign_id'), 'my_table', array('id'), 'my_fk', array('onDelete' => 'CASCADE')
);
$this->assertEquals(
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table(id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE",
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE",
$this->_platform->getForeignKeyDeclarationSQL($foreignKey)
);
}
......
......@@ -62,6 +62,6 @@ class MySQLSchemaTest extends \PHPUnit_Framework_TestCase
$sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld);
}
$this->assertEquals(array("ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id) REFERENCES test_foreign(foo_id)"), $sqls);
$this->assertEquals(array("ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id) REFERENCES test_foreign (foo_id)"), $sqls);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment