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
5d4f9335
Unverified
Commit
5d4f9335
authored
Dec 06, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo/2.9/#3393' into 2.9
parents
62dacc09
b18f63cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+16
-14
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+5
-1
No files found.
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
5d4f9335
...
...
@@ -18,7 +18,6 @@ use function stripslashes;
use
function
strpos
;
use
function
strtok
;
use
function
strtolower
;
use
function
trim
;
/**
* Schema manager for the MySql RDBMS.
...
...
@@ -305,25 +304,28 @@ class MySqlSchemaManager extends AbstractSchemaManager
$table
->
addOption
(
'autoincrement'
,
$tableOptions
[
'AUTO_INCREMENT'
]);
}
$table
->
addOption
(
'comment'
,
$tableOptions
[
'TABLE_COMMENT'
]);
$table
->
addOption
(
'create_options'
,
$this
->
parseCreateOptions
(
$tableOptions
[
'CREATE_OPTIONS'
]));
if
(
$tableOptions
[
'CREATE_OPTIONS'
]
===
null
)
{
return
$table
;
}
return
$table
;
}
$createOptionsString
=
trim
(
$tableOptions
[
'CREATE_OPTIONS'
]);
/**
* @return string[]|true[]
*/
private
function
parseCreateOptions
(
string
$string
)
:
array
{
$options
=
[];
$createOptions
=
[];
if
(
$string
===
''
)
{
return
$options
;
}
if
(
$createOptionsString
!==
''
)
{
foreach
(
explode
(
' '
,
$createOptionsString
)
as
$option
)
{
[
$createOption
,
$value
]
=
explode
(
'='
,
$option
);
foreach
(
explode
(
' '
,
$string
)
as
$pair
)
{
$parts
=
explode
(
'='
,
$pair
,
2
);
$createOptions
[
$createOption
]
=
$value
;
}
$options
[
$parts
[
0
]]
=
$parts
[
1
]
??
true
;
}
$table
->
addOption
(
'create_options'
,
$createOptions
);
return
$table
;
return
$options
;
}
}
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
5d4f9335
...
...
@@ -502,6 +502,7 @@ ENGINE InnoDB
ROW_FORMAT COMPRESSED
COMMENT 'This is a test'
AUTO_INCREMENT=42
PARTITION BY HASH (col1)
SQL;
$this
->
connection
->
query
(
$sql
);
...
...
@@ -511,7 +512,10 @@ SQL;
self
::
assertEquals
(
'utf8_general_ci'
,
$onlineTable
->
getOption
(
'collation'
));
self
::
assertEquals
(
42
,
$onlineTable
->
getOption
(
'autoincrement'
));
self
::
assertEquals
(
'This is a test'
,
$onlineTable
->
getOption
(
'comment'
));
self
::
assertEquals
([
'row_format'
=>
'COMPRESSED'
],
$onlineTable
->
getOption
(
'create_options'
));
self
::
assertEquals
([
'row_format'
=>
'COMPRESSED'
,
'partitioned'
=>
true
,
],
$onlineTable
->
getOption
(
'create_options'
));
}
public
function
testEnsureTableWithoutOptionsAreReflectedInMetadata
()
:
void
...
...
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