Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7431643
Comparator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Comparator.php
View Options
<?php
namespace
Doctrine\DBAL\Platforms\SQLServer
;
use
Doctrine\DBAL\Platforms\SQLServerPlatform
;
use
Doctrine\DBAL\Schema\Comparator
as
BaseComparator
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\TableDiff
;
/**
* Compares schemas in the context of SQL Server platform.
*
* @link https://docs.microsoft.com/en-us/sql/t-sql/statements/collations?view=sql-server-ver15
*/
class
Comparator
extends
BaseComparator
{
private
string
$databaseCollation
;
/** @internal The comparator can be only instantiated by a schema manager. */
public
function
__construct
(
SQLServerPlatform
$platform
,
string
$databaseCollation
)
{
parent
::
__construct
(
$platform
);
$this
->
databaseCollation
=
$databaseCollation
;
}
public
function
compareTables
(
Table
$fromTable
,
Table
$toTable
):
TableDiff
{
return
parent
::
compareTables
(
$this
->
normalizeColumns
(
$fromTable
),
$this
->
normalizeColumns
(
$toTable
),
);
}
/**
* {@inheritDoc}
*/
public
function
diffTable
(
Table
$fromTable
,
Table
$toTable
)
{
return
parent
::
diffTable
(
$this
->
normalizeColumns
(
$fromTable
),
$this
->
normalizeColumns
(
$toTable
),
);
}
private
function
normalizeColumns
(
Table
$table
):
Table
{
$table
=
clone
$table
;
foreach
(
$table
->
getColumns
()
as
$column
)
{
$options
=
$column
->
getPlatformOptions
();
if
(!
isset
(
$options
[
'collation'
])
||
$options
[
'collation'
]
!==
$this
->
databaseCollation
)
{
continue
;
}
unset
(
$options
[
'collation'
]);
$column
->
setPlatformOptions
(
$options
);
}
return
$table
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 11:02 (1 d, 12 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
05/7d/0a3238054e9a58cdec7b2b4221fe
Default Alt Text
Comparator.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment