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
e60a5828
Unverified
Commit
e60a5828
authored
Jun 29, 2017
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/#2730-remove-duplicate-comment-section-in-sql-schema-change'
Close #2730
parents
8e3159b3
8960f95c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+3
-3
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+22
-0
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
e60a5828
...
@@ -2238,11 +2238,11 @@ abstract class AbstractPlatform
...
@@ -2238,11 +2238,11 @@ abstract class AbstractPlatform
$typeDecl
=
$field
[
'type'
]
->
getSQLDeclaration
(
$field
,
$this
);
$typeDecl
=
$field
[
'type'
]
->
getSQLDeclaration
(
$field
,
$this
);
$columnDef
=
$typeDecl
.
$charset
.
$default
.
$notnull
.
$unique
.
$check
.
$collation
;
$columnDef
=
$typeDecl
.
$charset
.
$default
.
$notnull
.
$unique
.
$check
.
$collation
;
}
if
(
$this
->
supportsInlineColumnComments
()
&&
isset
(
$field
[
'comment'
])
&&
$field
[
'comment'
]
!==
''
)
{
if
(
$this
->
supportsInlineColumnComments
()
&&
isset
(
$field
[
'comment'
])
&&
$field
[
'comment'
]
!==
''
)
{
$columnDef
.=
' '
.
$this
->
getInlineColumnCommentSQL
(
$field
[
'comment'
]);
$columnDef
.=
' '
.
$this
->
getInlineColumnCommentSQL
(
$field
[
'comment'
]);
}
}
}
return
$name
.
' '
.
$columnDef
;
return
$name
.
' '
.
$columnDef
;
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
e60a5828
...
@@ -1048,6 +1048,28 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
...
@@ -1048,6 +1048,28 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this
->
assertEquals
(
"It's a comment with a quote"
,
$columns
[
'id'
]
->
getComment
());
$this
->
assertEquals
(
"It's a comment with a quote"
,
$columns
[
'id'
]
->
getComment
());
}
}
public
function
testCommentNotDuplicated
()
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsInlineColumnComments
())
{
$this
->
markTestSkipped
(
'Database does not support column comments.'
);
}
$options
=
array
(
'type'
=>
Type
::
getType
(
'integer'
),
'default'
=>
0
,
'notnull'
=>
true
,
'comment'
=>
'expected+column+comment'
,
);
$columnDefinition
=
substr
(
$this
->
_conn
->
getDatabasePlatform
()
->
getColumnDeclarationSQL
(
'id'
,
$options
),
strlen
(
'id'
)
+
1
);
$table
=
new
Table
(
'my_table'
);
$table
->
addColumn
(
'id'
,
'integer'
,
array
(
'columnDefinition'
=>
$columnDefinition
,
'comment'
=>
'unexpected_column_comment'
));
$sql
=
$this
->
_conn
->
getDatabasePlatform
()
->
getCreateTableSQL
(
$table
);
$this
->
assertContains
(
'expected+column+comment'
,
$sql
[
0
]);
$this
->
assertNotContains
(
'unexpected_column_comment'
,
$sql
[
0
]);
}
/**
/**
* @group DBAL-1009
* @group DBAL-1009
*
*
...
...
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