Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
258bed32
Commit
258bed32
authored
Aug 18, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBAL-148 - Foreign Key Creation
parent
0f3f8769
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
7 deletions
+7
-7
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+1
-1
MsSqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
+1
-1
MySqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+1
-1
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+1
-1
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+2
-2
MySQLSchemaTest.php
.../Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
+1
-1
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
258bed32
...
...
@@ -1671,7 +1671,7 @@ abstract class AbstractPlatform
$sql
.=
implode
(
', '
,
$foreignKey
->
getLocalColumns
())
.
') REFERENCES '
.
$foreignKey
->
getForeignTableName
()
.
'('
.
$foreignKey
->
getForeignTableName
()
.
'
('
.
implode
(
', '
,
$foreignKey
->
getForeignColumns
())
.
')'
;
return
$sql
;
...
...
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
View file @
258bed32
...
...
@@ -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
()
...
...
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
View file @
258bed32
...
...
@@ -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)'
;
}
/**
...
...
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
258bed32
...
...
@@ -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
()
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
258bed32
...
...
@@ -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
)
);
}
...
...
tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
View file @
258bed32
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment