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
3caada2b
Commit
3caada2b
authored
Jun 06, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed DBAL-2
parent
ade10e9a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+7
-21
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+15
-2
No files found.
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
3caada2b
<?php
<?php
/*
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
@@ -34,19 +32,6 @@ namespace Doctrine\DBAL\Schema;
...
@@ -34,19 +32,6 @@ namespace Doctrine\DBAL\Schema;
*/
*/
class
Comparator
class
Comparator
{
{
/**
* @var array
*/
private
$_checkColumnPlatformOptions
=
array
();
/**
* @param string $optionName
*/
public
function
addColumnPlatformOptionCheck
(
$optionName
)
{
$this
->
_checkColumnPlatformOptions
[]
=
$optionName
;
}
/**
/**
* @param Schema $fromSchema
* @param Schema $fromSchema
* @param Schema $toSchema
* @param Schema $toSchema
...
@@ -340,12 +325,13 @@ class Comparator
...
@@ -340,12 +325,13 @@ class Comparator
}
}
}
}
foreach
(
$this
->
_checkColumnPlatformOptions
AS
$optionName
)
{
foreach
(
$column1
->
getPlatformOptions
()
AS
$optionName
=>
$optionValue
)
{
if
(
$column1
->
hasPlatformOption
(
$optionName
)
&&
$column2
->
hasPlatformOption
(
$optionName
))
{
if
(
!
$column2
->
hasPlatformOption
(
$optionName
)
||
$optionValue
!=
$column2
->
getPlatformOption
(
$optionName
))
{
if
(
$column1
->
getPlatformOption
(
$optionName
)
!=
$column2
->
getPlatformOption
(
$optionName
))
{
$changedProperties
[]
=
$optionName
;
$changedProperties
[]
=
$optionName
;
}
}
}
else
if
(
$column1
->
hasPlatformOption
(
$optionName
)
!=
$column2
->
hasPlatformOption
(
$optionName
))
{
}
foreach
(
$column2
->
getPlatformOptions
()
AS
$optionName
=>
$optionValue
)
{
if
(
!
$column1
->
hasPlatformOption
(
$optionName
))
{
$changedProperties
[]
=
$optionName
;
$changedProperties
[]
=
$optionName
;
}
}
}
}
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
3caada2b
<?php
<?php
/*
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
@@ -572,6 +570,21 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
...
@@ -572,6 +570,21 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'bar'
,
$tableDiff
->
renamedColumns
[
'foo'
]
->
getName
());
$this
->
assertEquals
(
'bar'
,
$tableDiff
->
renamedColumns
[
'foo'
]
->
getName
());
}
}
public
function
testDetectChangeIdentifierType
()
{
$tableA
=
new
Table
(
"foo"
);
$tableA
->
addColumn
(
'id'
,
'integer'
,
array
(
'platformOptions'
=>
array
(
'autoincrement'
=>
false
)));
$tableB
=
new
Table
(
"foo"
);
$tableB
->
addColumn
(
'id'
,
'integer'
,
array
(
'platformOptions'
=>
array
(
'autoincrement'
=>
true
)));
$c
=
new
Comparator
();
$tableDiff
=
$c
->
diffTable
(
$tableA
,
$tableB
);
$this
->
assertType
(
'Doctrine\DBAL\Schema\TableDiff'
,
$tableDiff
);
$this
->
assertArrayHasKey
(
'id'
,
$tableDiff
->
changedColumns
);
}
/**
/**
* @param SchemaDiff $diff
* @param SchemaDiff $diff
* @param int $newTableCount
* @param int $newTableCount
...
...
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