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
d7908fee
Commit
d7908fee
authored
Nov 24, 2012
by
Alessandro Tagliapietra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test and fix for DBAL-392 Moving entity relationship doesn't move foreign key in mysql table
parent
c125e229
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+4
-0
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+23
-0
No files found.
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
d7908fee
...
...
@@ -317,6 +317,10 @@ class Comparator
return
true
;
}
if
(
strtolower
(
$key1
->
getForeignTableName
())
!=
strtolower
(
$key2
->
getForeignTableName
()))
{
return
true
;
}
if
(
$key1
->
onUpdate
()
!=
$key2
->
onUpdate
())
{
return
true
;
}
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
d7908fee
...
...
@@ -486,6 +486,29 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
1
,
count
(
$tableDiff
->
changedForeignKeys
));
}
public
function
testMovedForeignKeyForeignTable
()
{
$tableForeign
=
new
Table
(
"bar"
);
$tableForeign
->
addColumn
(
'id'
,
'integer'
);
$tableForeign2
=
new
Table
(
"bar2"
);
$tableForeign2
->
addColumn
(
'id'
,
'integer'
);
$table1
=
new
Table
(
"foo"
);
$table1
->
addColumn
(
'fk'
,
'integer'
);
$table1
->
addForeignKeyConstraint
(
$tableForeign
,
array
(
'fk'
),
array
(
'id'
));
$table2
=
new
Table
(
"foo"
);
$table2
->
addColumn
(
'fk'
,
'integer'
);
$table2
->
addForeignKeyConstraint
(
$tableForeign2
,
array
(
'fk'
),
array
(
'id'
));
$c
=
new
Comparator
();
$tableDiff
=
$c
->
diffTable
(
$table1
,
$table2
);
$this
->
assertInstanceOf
(
'Doctrine\DBAL\Schema\TableDiff'
,
$tableDiff
);
$this
->
assertEquals
(
1
,
count
(
$tableDiff
->
changedForeignKeys
));
}
public
function
testTablesCaseInsensitive
()
{
$schemaA
=
new
Schema
();
...
...
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