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
2ae916ad
Commit
2ae916ad
authored
Dec 21, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-591' into 2.4
parents
4e024dcb
e1cd82a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+1
-1
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+27
-0
No files found.
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
2ae916ad
...
...
@@ -484,7 +484,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' RENAME TO '
.
$diff
->
newName
;
}
$sql
=
array_merge
(
$
sql
,
$this
->
_ge
tAlterTableIndexForeignKeySQL
(
$diff
),
$commentsSQL
);
$sql
=
array_merge
(
$
this
->
getPreAlterTableIndexForeignKeySQL
(
$diff
),
$sql
,
$this
->
getPos
tAlterTableIndexForeignKeySQL
(
$diff
),
$commentsSQL
);
}
return
array_merge
(
$sql
,
$tableSql
,
$columnSql
);
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
2ae916ad
...
...
@@ -363,5 +363,32 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
$this
->
assertEquals
(
$expectedSql
,
$sql
);
}
/**
* @group DBAL-365
*/
public
function
testDroppingConstraintsBeforeColumns
()
{
$newTable
=
new
Table
(
'mytable'
);
$newTable
->
addColumn
(
'id'
,
'integer'
);
$newTable
->
setPrimaryKey
(
array
(
'id'
));
$oldTable
=
clone
$newTable
;
$oldTable
->
addColumn
(
'parent_id'
,
'integer'
);
$oldTable
->
addUnnamedForeignKeyConstraint
(
'mytable'
,
array
(
'parent_id'
),
array
(
'id'
));
$comparator
=
new
\Doctrine\DBAL\Schema\Comparator
();
$tableDiff
=
$comparator
->
diffTable
(
$oldTable
,
$newTable
);
$sql
=
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
);
$expectedSql
=
array
(
'ALTER TABLE mytable DROP CONSTRAINT FK_6B2BD609727ACA70'
,
'DROP INDEX IDX_6B2BD609727ACA70'
,
'ALTER TABLE mytable DROP parent_id'
,
);
$this
->
assertEquals
(
$expectedSql
,
$sql
);
}
}
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