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
d8709c5c
Commit
d8709c5c
authored
Aug 17, 2014
by
Shane Archer
Committed by
Marco Pivetta
Aug 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit test for DateTime/DateTimeTz default timestamps; made same change for SQL server.
parent
1d92a8ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+1
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+23
-0
No files found.
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
d8709c5c
...
...
@@ -1458,7 +1458,7 @@ class SQLServerPlatform extends AbstractPlatform
return
" DEFAULT "
.
$field
[
'default'
];
}
if
(
(
string
)
$field
[
'type'
]
==
'DateTime'
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
'DateTime'
,
'DateTimeTz'
))
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
return
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
d8709c5c
...
...
@@ -440,6 +440,29 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
}
public
function
testGetDefaultValueDeclarationSQL
()
{
// timestamps on datetime types should not be quoted
foreach
(
array
(
'datetime'
,
'datetimetz'
)
as
$type
)
{
$field
=
array
(
'type'
=>
Type
::
getType
(
$type
),
'default'
=>
$this
->
_platform
->
getCurrentTimestampSQL
()
);
$this
->
assertEquals
(
' DEFAULT '
.
$this
->
_platform
->
getCurrentTimestampSQL
(),
$this
->
_platform
->
getDefaultValueDeclarationSQL
(
$field
));
}
// non-timestamp value will get single quotes
$field
=
array
(
'type'
=>
'string'
,
'default'
=>
'non_timestamp'
);
$this
->
assertEquals
(
" DEFAULT 'non_timestamp'"
,
$this
->
_platform
->
getDefaultValueDeclarationSQL
(
$field
));
}
/**
* @group DBAL-45
*/
...
...
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