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
68764374
Commit
68764374
authored
Nov 16, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #228 from lsmith77/deferred_typo_fix
fixed typo for enabling DEFERRED support
parents
3af9edb2
d3d9fcdd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+3
-1
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+40
-0
No files found.
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
68764374
...
...
@@ -322,7 +322,9 @@ class PostgreSqlPlatform extends AbstractPlatform
$query
.=
' NOT DEFERRABLE'
;
}
if
(
$foreignKey
->
hasOption
(
'feferred'
)
&&
$foreignKey
->
getOption
(
'feferred'
)
!==
false
)
{
if
((
$foreignKey
->
hasOption
(
'feferred'
)
&&
$foreignKey
->
getOption
(
'feferred'
)
!==
false
)
||
(
$foreignKey
->
hasOption
(
'deferred'
)
&&
$foreignKey
->
getOption
(
'deferred'
)
!==
false
)
)
{
$query
.=
' INITIALLY DEFERRED'
;
}
else
{
$query
.=
' INITIALLY IMMEDIATE'
;
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
68764374
...
...
@@ -59,6 +59,46 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE"
,
$this
->
_platform
->
getForeignKeyDeclarationSQL
(
$foreignKey
)
);
$foreignKey
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'foreign_id'
),
'my_table'
,
array
(
'id'
),
'my_fk'
,
array
(
'match'
=>
'full'
)
);
$this
->
assertEquals
(
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) MATCH full NOT DEFERRABLE INITIALLY IMMEDIATE"
,
$this
->
_platform
->
getForeignKeyDeclarationSQL
(
$foreignKey
)
);
$foreignKey
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'foreign_id'
),
'my_table'
,
array
(
'id'
),
'my_fk'
,
array
(
'deferrable'
=>
true
)
);
$this
->
assertEquals
(
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) DEFERRABLE INITIALLY IMMEDIATE"
,
$this
->
_platform
->
getForeignKeyDeclarationSQL
(
$foreignKey
)
);
$foreignKey
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'foreign_id'
),
'my_table'
,
array
(
'id'
),
'my_fk'
,
array
(
'deferred'
=>
true
)
);
$this
->
assertEquals
(
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED"
,
$this
->
_platform
->
getForeignKeyDeclarationSQL
(
$foreignKey
)
);
$foreignKey
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'foreign_id'
),
'my_table'
,
array
(
'id'
),
'my_fk'
,
array
(
'feferred'
=>
true
)
);
$this
->
assertEquals
(
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED"
,
$this
->
_platform
->
getForeignKeyDeclarationSQL
(
$foreignKey
)
);
$foreignKey
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'foreign_id'
),
'my_table'
,
array
(
'id'
),
'my_fk'
,
array
(
'deferrable'
=>
true
,
'deferred'
=>
true
,
'match'
=>
'full'
)
);
$this
->
assertEquals
(
"CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) MATCH full DEFERRABLE INITIALLY DEFERRED"
,
$this
->
_platform
->
getForeignKeyDeclarationSQL
(
$foreignKey
)
);
}
public
function
testGeneratesSqlSnippets
()
...
...
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