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
6b9ead7f
Unverified
Commit
6b9ead7f
authored
Oct 12, 2017
by
belgattitude
Committed by
Luís Cobucci
Nov 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review from @morozov about nulls
parent
4ddc496d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+6
-0
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+4
-4
No files found.
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
6b9ead7f
...
...
@@ -220,9 +220,15 @@ class MySqlSchemaManager extends AbstractSchemaManager
* - CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE are stored in information_schema
* as current_timestamp(), currdate(), currtime()
* - Literal escaping is normalized in information schema (store "''" instead of "\'")
* - Note: columnDefault should only be null when column is not_nullable otherwise
* a string 'NULL' should be given. Unfortunately, it's not 100% correct in case of
* upgrade from previous versions: see https://jira.mariadb.org/browse/MDEV-14053.
* Otherwise we could simplify the condition === 'NULL' || === null by adding the parameter
* is_nullable.
*
* @link https://mariadb.com/kb/en/library/information-schema-columns-table/
* @link https://jira.mariadb.org/browse/MDEV-13132
* @link https://jira.mariadb.org/browse/MDEV-14053
*
* @param null|string $columnDefault default value as stored in information_schema for MariaDB >= 10.2.7
*/
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
6b9ead7f
...
...
@@ -423,18 +423,18 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$sql
=
"
CREATE TABLE test_column_defaults_with_create (
col1 VARCHAR(255) NULL DEFAULT 'O''Connor\'
\"
',
col2 VARCHAR(255) N
ULL DEFAULT '''A'''
col2 VARCHAR(255) N
OT NULL DEFAULT 'O''Connor\'
\"
'
);
"
;
$this
->
_conn
->
query
(
$sql
);
$onlineTable
=
$this
->
_sm
->
listTableDetails
(
"test_column_defaults_with_create"
);
self
::
assertSame
(
"O'Connor'
\"
"
,
$onlineTable
->
getColumn
(
'col1'
)
->
getDefault
());
self
::
assertSame
(
"
'A'
"
,
$onlineTable
->
getColumn
(
'col2'
)
->
getDefault
());
self
::
assertSame
(
"
O'Connor'
\"
"
,
$onlineTable
->
getColumn
(
'col2'
)
->
getDefault
());
$table
=
new
Table
(
"test_column_defaults_no_diff"
);
$table
->
addColumn
(
'col1'
,
'string'
,
[
'notnull'
=>
false
,
'default'
=>
"O'Connor'
\"
"
]);
$table
->
addColumn
(
'col2'
,
'string'
,
[
'notnull'
=>
false
,
'default'
=>
"'A'
"
]);
$table
->
addColumn
(
'col2'
,
'string'
,
[
'notnull'
=>
true
,
'default'
=>
"O'Connor'
\"
"
]);
$comparator
=
new
Comparator
();
$diff
=
$comparator
->
diffTable
(
$table
,
$onlineTable
);
...
...
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