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
a92784a1
Commit
a92784a1
authored
Dec 22, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DDC-2843] Fix default value of PostgreSQL boolean columns.
parent
6e76a638
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+8
-0
PostgreSqlSchemaManagerTest.php
...ts/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
+19
-0
No files found.
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
a92784a1
...
...
@@ -343,6 +343,14 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
break
;
case
'bool'
:
case
'boolean'
:
if
(
$tableColumn
[
'default'
]
===
'true'
)
{
$tableColumn
[
'default'
]
=
true
;
}
if
(
$tableColumn
[
'default'
]
===
'false'
)
{
$tableColumn
[
'default'
]
=
false
;
}
$length
=
null
;
break
;
case
'text'
:
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
View file @
a92784a1
...
...
@@ -261,6 +261,25 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
assertEquals
(
'foo'
,
$databaseTable
->
getColumn
(
'def'
)
->
getDefault
());
}
/**
* @group DDC-2843
*/
public
function
testBooleanDefault
()
{
$table
=
new
\Doctrine\DBAL\Schema\Table
(
'ddc2843_bools'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'checked'
,
'boolean'
,
array
(
'default'
=>
false
));
$this
->
_sm
->
createTable
(
$table
);
$databaseTable
=
$this
->
_sm
->
listTableDetails
(
$table
->
getName
());
$c
=
new
\Doctrine\DBAL\Schema\Comparator
();
$diff
=
$c
->
diffTable
(
$table
,
$databaseTable
);
$this
->
assertFalse
(
$diff
);
}
}
class
MoneyType
extends
Type
...
...
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