Skip to content

Commit a809498

Browse files
committed
MAGETWO-95595: Index names are ignored by declarative schema
- test disable index
1 parent 73d515e commit a809498

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
10+
<table name="test_table" resource="default">
11+
<index referenceId="TEST_TABLE_TINYINT_BIGINT" disabled="1"/>
12+
</table>
13+
</schema>

dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,29 @@ public function testForeignKeyReferenceId()
317317
$this->assertRegExp('/CONSTRAINT\s`DEPENDENT_PAGE_ID_ON_TEST_TABLE_PAGE_ID`/', $tableSql);
318318
$this->assertRegExp('/CONSTRAINT\s`DEPENDENT_SCOPE_ID_ON_TEST_SCOPE_TABLE_SCOPE_ID`/', $tableSql);
319319
}
320+
321+
/**
322+
* @moduleName Magento_TestSetupDeclarationModule1
323+
* @moduleName Magento_TestSetupDeclarationModule8
324+
*/
325+
public function testDisableIndexByExternalModule()
326+
{
327+
$this->cliCommad->install(
328+
['Magento_TestSetupDeclarationModule1', 'Magento_TestSetupDeclarationModule8']
329+
);
330+
$this->moduleManager->updateRevision(
331+
'Magento_TestSetupDeclarationModule8',
332+
'disable_index_by_external_module',
333+
'db_schema.xml',
334+
'etc'
335+
);
336+
$this->cliCommad->upgrade();
337+
$tableStatements = $this->describeTable->describeShard('default');
338+
$tableSql = $tableStatements['test_table'];
339+
$this->assertNotRegExp(
340+
'/KEY\s+`TEST_TABLE_TINYINT_BIGINT`\s+\(`tinyint`,`bigint`\)/',
341+
$tableSql,
342+
'Index is not being disabled by external module'
343+
);
344+
}
320345
}

0 commit comments

Comments
 (0)