Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
latoilescoute-dev
scoodle
Commits
d0799357
Commit
d0799357
authored
Mar 22, 2018
by
Thomas Citharel
Browse files
Merge branch 'develop' into 'master'
Version 1.1.0-alpha.3 See merge request framasoft/framadate!248
parents
17f16cd0
4631b8d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/classes/Framadate/Migration/Fix_MySQL_No_Zero_Date.php
View file @
d0799357
...
...
@@ -44,7 +44,7 @@ class Fix_MySQL_No_Zero_Date implements Migration {
* It is called before the execute method.
*
* @param \PDO $pdo The connection to database
* @return bool true i
s
the Migration should be executed.
* @return bool true i
f
the Migration should be executed.
*/
function
preCondition
(
\
PDO
$pdo
)
{
$stmt
=
$pdo
->
prepare
(
"SELECT Column_Default from Information_Schema.Columns where Table_Name = ? AND Column_Name = ?;"
);
...
...
@@ -53,16 +53,18 @@ class Fix_MySQL_No_Zero_Date implements Migration {
$stmt
->
execute
();
$default
=
$stmt
->
fetch
(
\
PDO
::
FETCH_COLUMN
);
return
$default
!==
null
;
$driver_name
=
$pdo
->
getAttribute
(
\
PDO
::
ATTR_DRIVER_NAME
);
return
$default
!==
null
&&
$driver_name
===
'mysql'
;
}
/**
* This method is called only one time in the migration page.
*
* @param \PDO $pdo The connection to database
* @return
void true is
the execution succeeded
* @return
bool|void if
the execution succeeded
*/
function
execute
(
\
PDO
$pdo
)
{
$pdo
->
exec
(
'ALTER TABLE '
.
Utils
::
table
(
'poll'
)
.
'
CHANGE COLUMN
end_date TIMESTAMP NULL DEFAULT NULL'
);
$pdo
->
exec
(
'ALTER TABLE '
.
Utils
::
table
(
'poll'
)
.
'
MODIFY
end_date TIMESTAMP NULL DEFAULT NULL
;
'
);
}
}
Write
Preview
Supports
Markdown
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