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
d6ee8aa7
Commit
d6ee8aa7
authored
Sep 02, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix GUID type comparator issues
parent
0b609e49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+3
-1
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+20
-0
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+15
-0
No files found.
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
d6ee8aa7
...
...
@@ -399,7 +399,9 @@ class Comparator
$changedProperties
[]
=
'default'
;
}
if
(
$properties1
[
'type'
]
instanceof
Types\StringType
||
$properties1
[
'type'
]
instanceof
Types\BinaryType
)
{
if
((
$properties1
[
'type'
]
instanceof
Types\StringType
&&
!
$properties1
[
'type'
]
instanceof
Types\GuidType
)
||
$properties1
[
'type'
]
instanceof
Types\BinaryType
)
{
// check if value of length is set at all, default value assumed otherwise.
$length1
=
$properties1
[
'length'
]
?:
255
;
$length2
=
$properties2
[
'length'
]
?:
255
;
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
d6ee8aa7
...
...
@@ -259,4 +259,24 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$platform
->
getBlobTypeDeclarationSQL
(
$onlineColumns
[
'col_longblob'
]
->
toArray
())
);
}
/**
* @group DBAL-423
*/
public
function
testDiffListGuidTableColumn
()
{
$offlineTable
=
new
Table
(
'list_guid_table_column'
);
$offlineTable
->
addColumn
(
'col_guid'
,
'guid'
);
$this
->
_sm
->
dropAndCreateTable
(
$offlineTable
);
$onlineTable
=
$this
->
_sm
->
listTableDetails
(
'list_guid_table_column'
);
$comparator
=
new
Comparator
();
$this
->
assertFalse
(
$comparator
->
diffTable
(
$offlineTable
,
$onlineTable
),
"No differences should be detected with the offline vs online schema."
);
}
}
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
d6ee8aa7
...
...
@@ -1107,4 +1107,19 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$expected
,
$comparator
->
compare
(
$fromSchema
,
$toSchema
));
}
public
function
testCompareGuidColumns
()
{
$comparator
=
new
Comparator
();
$column1
=
new
Column
(
'foo'
,
Type
::
getType
(
'guid'
),
array
(
'comment'
=>
'GUID 1'
));
$column2
=
new
Column
(
'foo'
,
Type
::
getType
(
'guid'
),
array
(
'notnull'
=>
false
,
'length'
=>
'36'
,
'fixed'
=>
true
,
'default'
=>
'NEWID()'
,
'comment'
=>
'GUID 2.'
)
);
$this
->
assertEquals
(
array
(
'notnull'
,
'default'
,
'comment'
),
$comparator
->
diffColumn
(
$column1
,
$column2
));
$this
->
assertEquals
(
array
(
'notnull'
,
'default'
,
'comment'
),
$comparator
->
diffColumn
(
$column2
,
$column1
));
}
}
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