Remove Index from Table
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 40
- Joined: 12 Jul 2018, 19:57
Remove Index from Table
Hi there;
I've create a product.php file inside custom/setup/default/schema to modify some stuff in the database.
but the index never is remove, how can I remove the index ?
I did it from migrations, but when I run aimeos:setup the index is created agian.
Thanks
I've create a product.php file inside custom/setup/default/schema to modify some stuff in the database.
Code: Select all
return array(
'exlcude' => array(
'unq_mspropr_sid_tid_lid_value',
),
'table' => array(
'mshop_product_property' => function (\Doctrine\DBAL\Schema\Schema $schema) {
$table = $schema->getTable('mshop_product_property');
$table->dropIndex('idx_mspropr_sid_value');
return $schema;
},
),
);
I did it from migrations, but when I run aimeos:setup the index is created agian.
Thanks
--
Jorge A Ramirez
System Engineer
PHP Developer
Jorge A Ramirez
System Engineer
PHP Developer
Re: Remove Index from Table
First question: Why do you want to remove the index? Did you've changed the table structure and you want to add one that fits better for the new structure? Otherwise, it's a bad idea to remove indexes because this will slow down your application.
Second thing: You have a typo in the "exclude" key but I think you don't need an exclude for the index here.
The problem regarding removing the index might be that DBAL is adding the index to the table and you are removing it immediately again. Then, DBAL adds the index to it's "removedIndexes" property but it gets not really removed because the setup tasks are not executed in "clean" mode:
https://github.com/aimeos/aimeos-core/b ... p.php#L322
Can you verify that DBAL doesn't remove the index from the table definition? Maybe that's a bug in DBAL you should report if this is the case.
Second thing: You have a typo in the "exclude" key but I think you don't need an exclude for the index here.
The problem regarding removing the index might be that DBAL is adding the index to the table and you are removing it immediately again. Then, DBAL adds the index to it's "removedIndexes" property but it gets not really removed because the setup tasks are not executed in "clean" mode:
https://github.com/aimeos/aimeos-core/b ... p.php#L322
Can you verify that DBAL doesn't remove the index from the table definition? Maybe that's a bug in DBAL you should report if this is the case.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star