Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
1f958abb
Commit
1f958abb
authored
Feb 07, 2017
by
catch
Browse files
Issue
#2843595
by hussainweb, heddn, jonhattan: Add indexes to migrate_map_* tables
parent
2740e709
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
View file @
1f958abb
...
...
@@ -313,8 +313,10 @@ protected function ensureTables() {
// and map from the source field names to the map/msg field names.
$count
=
1
;
$source_id_schema
=
array
();
$indexes
=
[];
foreach
(
$this
->
migration
->
getSourcePlugin
()
->
getIds
()
as
$id_definition
)
{
$mapkey
=
'sourceid'
.
$count
++
;
$indexes
[
'source'
][]
=
$mapkey
;
$source_id_schema
[
$mapkey
]
=
$this
->
getFieldSchema
(
$id_definition
);
$source_id_schema
[
$mapkey
][
'not null'
]
=
TRUE
;
}
...
...
@@ -369,6 +371,7 @@ protected function ensureTables() {
'description'
=>
'Mappings from source identifier value(s) to destination identifier value(s).'
,
'fields'
=>
$fields
,
'primary key'
=>
array
(
static
::
SOURCE_IDS_HASH
),
'indexes'
=>
$indexes
,
);
$this
->
getDatabase
()
->
schema
()
->
createTable
(
$this
->
mapTableName
,
$schema
);
...
...
core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php
View file @
1f958abb
...
...
@@ -34,6 +34,10 @@ public function testEnsureTablesNotExist() {
'type'
=>
'int'
,
'not null'
=>
TRUE
,
);
$fields
[
'sourceid2'
]
=
array
(
'type'
=>
'int'
,
'not null'
=>
TRUE
,
);
$fields
[
'destid1'
]
=
array
(
'type'
=>
'varchar'
,
'length'
=>
255
,
...
...
@@ -72,6 +76,9 @@ public function testEnsureTablesNotExist() {
'description'
=>
'Mappings from source identifier value(s) to destination identifier value(s).'
,
'fields'
=>
$fields
,
'primary key'
=>
array
(
'source_ids_hash'
),
'indexes'
=>
[
'source'
=>
[
'sourceid1'
,
'sourceid2'
],
],
);
$schema
=
$this
->
getMockBuilder
(
'Drupal\Core\Database\Schema'
)
->
disableOriginalConstructor
()
...
...
@@ -205,6 +212,9 @@ protected function runEnsureTablesTest($schema) {
'source_id_property'
=>
array
(
'type'
=>
'integer'
,
),
'source_id_property_2'
=>
array
(
'type'
=>
'integer'
,
),
));
$migration
->
expects
(
$this
->
any
())
->
method
(
'getSourcePlugin'
)
...
...
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