I have recently installed and then uninstalled an extension (Cart2Quote) and now when I attempt to run the command:
php bin/magento setup:upgrade
I am getting the following error:
Notice: Undefined index: quotation_quote in /home/49555.cloudserv.com/ngjhhhsssf/public_html/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 153
Any ideas?
TIA, Rob
-
1Seems you removed the code, but the database changes still thereRaul Sanchez– Raul Sanchez2021年03月04日 07:27:22 +00:00Commented Mar 4, 2021 at 7:27
-
1Try to also delete all data from the generated directory. Run the command: "rm -rf generated/*" on Magento root and then run the upgrade commandAmit Saini– Amit Saini2021年03月04日 07:31:22 +00:00Commented Mar 4, 2021 at 7:31
-
@RaulSanchez - Thanks Raul - I did remove the associated data/rows from within the SETUP_MODULE table test still receiving the error.ozmo– ozmo2021年03月04日 07:42:12 +00:00Commented Mar 4, 2021 at 7:42
-
1Welcome @ozmo, Hope now upgrade command working fine.Amit Saini– Amit Saini2021年03月04日 09:01:51 +00:00Commented Mar 4, 2021 at 9:01
-
1@ozmo Follow this cart2quote.zendesk.com/hc/en-us/articles/…Amit Saini– Amit Saini2021年03月04日 09:33:02 +00:00Commented Mar 4, 2021 at 9:33
2 Answers 2
It think it could be a foreign key constraint somewhere in some table still referencing the removed table from the extension.
You can check this by running the following SQL query in your database if 'quotation_quote' is a column name:
SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_COLUMN_NAME = 'quotation_quote';
Or the following command if the 'quotation_quote' is the table:
SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = 'quotation_quote';
If you find matching results and you double-check that indeed this is the column added by the extension you uninstalled, then you can drop the constraint:
ALTER TABLE <TABLE_NAME> DROP FOREIGN KEY <CONSTRAINT_NAME>;
-
1
Go to here public_html/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php
and add a condition like below... In my case I had an issue for "quotation_quote" but in your case, it could be anything... so make sure you change the table....
if ($referenceTableName != "quotation_quote")
{
$referenceData['column'] = $table->getColumnByName($referenceData['column']);
$referenceData['referenceTable'] = $this->tables[$referenceTableName];
$referenceData['referenceColumn'] = $referenceData['referenceTable']->getColumnByName( $referenceData['referenceColumn'] );
$references[$referenceData['name']] = $this->elementFactory->create('foreign', $referenceData);
//We need to instantiate tables in order of references tree
if (isset($tables[$referenceTableName]) && $referenceTableName !== $tableName)
{
$this->processReferenceKeys([$referenceTableName => $tables[$referenceTableName]], $schema);
unset($tables[$referenceTableName]);
}
}