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
bfe33c3e
Unverified
Commit
bfe33c3e
authored
Oct 16, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo/2.8/#3158' into 2.8
parents
7d9f7d0e
6ce2ef72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+10
-2
AbstractPostgreSqlPlatformTestCase.php
...sts/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+23
-0
No files found.
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
bfe33c3e
...
...
@@ -591,11 +591,14 @@ class PostgreSqlPlatform extends AbstractPlatform
}
}
if
(
$columnDiff
->
hasChanged
(
'comment'
))
{
$newComment
=
$this
->
getColumnComment
(
$column
);
$oldComment
=
$this
->
getOldColumnComment
(
$columnDiff
);
if
(
$columnDiff
->
hasChanged
(
'comment'
)
||
(
$columnDiff
->
fromColumn
!==
null
&&
$oldComment
!==
$newComment
))
{
$commentsSQL
[]
=
$this
->
getCommentOnColumnSQL
(
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
),
$column
->
getQuotedName
(
$this
),
$
this
->
getColumnComment
(
$column
)
$
newComment
);
}
...
...
@@ -1254,4 +1257,9 @@ class PostgreSqlPlatform extends AbstractPlatform
{
return
$type
instanceof
IntegerType
||
$type
instanceof
BigIntType
;
}
private
function
getOldColumnComment
(
ColumnDiff
$columnDiff
)
:
?
string
{
return
$columnDiff
->
fromColumn
?
$this
->
getColumnComment
(
$columnDiff
->
fromColumn
)
:
null
;
}
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
View file @
bfe33c3e
...
...
@@ -853,6 +853,29 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
);
}
/**
* @group 3158
*/
public
function
testAltersTableColumnCommentIfRequiredByType
()
{
$table1
=
new
Table
(
'"foo"'
,
[
new
Column
(
'"bar"'
,
Type
::
getType
(
'datetime'
))]);
$table2
=
new
Table
(
'"foo"'
,
[
new
Column
(
'"bar"'
,
Type
::
getType
(
'datetime_immutable'
))]);
$comparator
=
new
Comparator
();
$tableDiff
=
$comparator
->
diffTable
(
$table1
,
$table2
);
$this
->
assertInstanceOf
(
'Doctrine\DBAL\Schema\TableDiff'
,
$tableDiff
);
$this
->
assertSame
(
[
'ALTER TABLE "foo" ALTER "bar" TYPE TIMESTAMP(0) WITHOUT TIME ZONE'
,
'ALTER TABLE "foo" ALTER "bar" DROP DEFAULT'
,
'COMMENT ON COLUMN "foo"."bar" IS \'(DC2Type:datetime_immutable)\''
,
],
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
)
);
}
/**
* {@inheritdoc}
*/
...
...
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