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
86679aa6
Commit
86679aa6
authored
Jul 19, 2013
by
Kirill chEbba Chebunin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-562] Prevent autoincrement columns from creating CREATE SEQUENCE statement on down migrations
parent
3253f7a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+3
-1
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+22
-0
No files found.
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
86679aa6
...
...
@@ -112,7 +112,9 @@ class Comparator
foreach
(
$toSchema
->
getSequences
()
as
$sequence
)
{
$sequenceName
=
$sequence
->
getShortestName
(
$toSchema
->
getName
());
if
(
!
$fromSchema
->
hasSequence
(
$sequenceName
))
{
$diff
->
newSequences
[]
=
$sequence
;
if
(
!
$this
->
isAutoIncrementSequenceInSchema
(
$fromSchema
,
$sequence
))
{
$diff
->
newSequences
[]
=
$sequence
;
}
}
else
{
if
(
$this
->
diffSequence
(
$sequence
,
$fromSchema
->
getSequence
(
$sequenceName
)))
{
$diff
->
changedSequences
[]
=
$toSchema
->
getSequence
(
$sequenceName
);
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
86679aa6
...
...
@@ -863,6 +863,28 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
}
/**
* Check that added autoincrement sequence is not populated in newSequences
* @group DBAL-562
*/
public
function
testAutoIncremenetNoSequences
()
{
$oldSchema
=
new
Schema
();
$table
=
$oldSchema
->
createTable
(
"foo"
);
$table
->
addColumn
(
"id"
,
"integer"
,
array
(
"autoincrement"
=>
true
));
$table
->
setPrimaryKey
(
array
(
"id"
));
$newSchema
=
new
Schema
();
$table
=
$newSchema
->
createTable
(
"foo"
);
$table
->
addColumn
(
"id"
,
"integer"
,
array
(
"autoincrement"
=>
true
));
$table
->
setPrimaryKey
(
array
(
"id"
));
$newSchema
->
createSequence
(
"foo_id_seq"
);
$c
=
new
Comparator
();
$diff
=
$c
->
compare
(
$oldSchema
,
$newSchema
);
$this
->
assertCount
(
0
,
$diff
->
newSequences
);
}
/**
* You can get multiple drops for a FK when a table referenced by a foreign
* key is deleted, as this FK is referenced twice, once on the orphanedForeignKeys
...
...
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