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
f9410513
Commit
f9410513
authored
Dec 23, 2011
by
Miloslav Kmet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed doctrine column type comments
parent
b066e54f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
1 deletion
+37
-1
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+1
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+15
-0
MySqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+5
-0
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+8
-0
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+8
-0
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
f9410513
...
@@ -1095,7 +1095,7 @@ abstract class AbstractPlatform
...
@@ -1095,7 +1095,7 @@ abstract class AbstractPlatform
$sql
=
$this
->
_getCreateTableSQL
(
$tableName
,
$columns
,
$options
);
$sql
=
$this
->
_getCreateTableSQL
(
$tableName
,
$columns
,
$options
);
if
(
$this
->
supportsCommentOnStatement
())
{
if
(
$this
->
supportsCommentOnStatement
())
{
foreach
(
$table
->
getColumns
()
AS
$column
)
{
foreach
(
$table
->
getColumns
()
AS
$column
)
{
if
(
$
column
->
getComment
(
))
{
if
(
$
this
->
getColumnComment
(
$column
))
{
$sql
[]
=
$this
->
getCommentOnColumnSQL
(
$tableName
,
$column
->
getName
(),
$this
->
getColumnComment
(
$column
));
$sql
[]
=
$this
->
getCommentOnColumnSQL
(
$tableName
,
$column
->
getName
(),
$this
->
getColumnComment
(
$column
));
}
}
}
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
f9410513
...
@@ -326,6 +326,16 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
...
@@ -326,6 +326,16 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
assertEquals
(
$this
->
getAlterTableColumnCommentsSQL
(),
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
));
$this
->
assertEquals
(
$this
->
getAlterTableColumnCommentsSQL
(),
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
));
}
}
public
function
testCreateTableColumnTypeComments
()
{
$table
=
new
\Doctrine\DBAL\Schema\Table
(
'test'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'data'
,
'array'
);
$table
->
setPrimaryKey
(
array
(
'id'
));
$this
->
assertEquals
(
$this
->
getCreateTableColumnTypeCommentsSQL
(),
$this
->
_platform
->
getCreateTableSQL
(
$table
));
}
public
function
getCreateTableColumnCommentsSQL
()
public
function
getCreateTableColumnCommentsSQL
()
{
{
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
...
@@ -336,6 +346,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
...
@@ -336,6 +346,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
}
}
public
function
getCreateTableColumnTypeCommentsSQL
()
{
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
}
/**
/**
* @group DBAL-45
* @group DBAL-45
*/
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
View file @
f9410513
...
@@ -204,4 +204,9 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
...
@@ -204,4 +204,9 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
{
{
return
array
(
"ALTER TABLE mytable ADD quota INT NOT NULL COMMENT 'A comment', CHANGE bar baz VARCHAR(255) NOT NULL COMMENT 'B comment'"
);
return
array
(
"ALTER TABLE mytable ADD quota INT NOT NULL COMMENT 'A comment', CHANGE bar baz VARCHAR(255) NOT NULL COMMENT 'B comment'"
);
}
}
public
function
getCreateTableColumnTypeCommentsSQL
()
{
return
array
(
"CREATE TABLE test (id INT NOT NULL, data LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) ENGINE = InnoDB"
);
}
}
}
\ No newline at end of file
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
f9410513
...
@@ -195,6 +195,14 @@ class OraclePlatformTest extends AbstractPlatformTestCase
...
@@ -195,6 +195,14 @@ class OraclePlatformTest extends AbstractPlatformTestCase
);
);
}
}
public
function
getCreateTableColumnTypeCommentsSQL
()
{
return
array
(
"CREATE TABLE test (id NUMBER(10) NOT NULL, data CLOB NOT NULL, PRIMARY KEY(id))"
,
"COMMENT ON COLUMN test.data IS '(DC2Type:array)'"
);
}
public
function
getAlterTableColumnCommentsSQL
()
public
function
getAlterTableColumnCommentsSQL
()
{
{
return
array
(
return
array
(
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
f9410513
...
@@ -216,4 +216,12 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
...
@@ -216,4 +216,12 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
"COMMENT ON COLUMN mytable.baz IS 'B comment'"
,
"COMMENT ON COLUMN mytable.baz IS 'B comment'"
,
);
);
}
}
public
function
getCreateTableColumnTypeCommentsSQL
()
{
return
array
(
"CREATE TABLE test (id INT NOT NULL, data TEXT NOT NULL, PRIMARY KEY(id))"
,
"COMMENT ON COLUMN test.data IS '(DC2Type:array)'"
);
}
}
}
\ No newline at end of file
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