magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Db prefix breaks 2.4.7-beta1 install #37756

Closed sta1r closed 1 year ago

sta1r commented 1 year ago

Preconditions and environment

Steps to reproduce

  1. composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.7-beta1 magento-cc-2.4.7
  2. bin/magento setup:install \
    --use-secure=1 \
    --use-secure-admin=1 \
    --base-url=http://m247cc.am:8890 \
    --base-url-secure=https://m247cc.am:8890 \
    --db-host=localhost \
    --db-name=commerce247 \
    --db-password=root \
    --db-prefix=foo_ \
    --backend-frontname=admin \
    --admin-firstname=Foo \
    --admin-lastname=Bar \
    --admin-email=admin@foo.com \
    --admin-user=admin \
    --admin-password=password \
    --language=en_US \
    --currency=USD \
    --timezone=America/Chicago \
    --use-rewrites=1 

Expected result

Actual result

Starting Magento installation:
File permissions check...
[Progress: 1 / 1911]
Required extensions check...
[Progress: 2 / 1911]
Enabling Maintenance Mode...
[Progress: 3 / 1911]
Installing deployment configuration...
[Progress: 4 / 1911]
Installing database schema:
Schema creation/updates:

There is an error in /Sites/magento-cc-2.4.7/vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php at line: 253
Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder::processTable(): Return value must be of type Magento\Framework\Setup\Declaration\Schema\Dto\Table, bool returned#0 /Sites/magento-cc-2.4.7/vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php(150): Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder->processTable(Object(Magento\Framework\Setup\Declaration\Schema\Dto\Schema), Array)
#1 /Sites/magento-cc-2.4.7/vendor/magento/framework/Setup/Declaration/Schema/SchemaConfig.php(78): Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder->build(Object(Magento\Framework\Setup\Declaration\Schema\Dto\Schema))
#2 /Sites/magento-cc-2.4.7/setup/src/Magento/Setup/Model/DeclarationInstaller.php(57): Magento\Framework\Setup\Declaration\Schema\SchemaConfig->getDeclarationConfig()
#3 /Sites/magento-cc-2.4.7/setup/src/Magento/Setup/Model/Installer.php(849): Magento\Setup\Model\DeclarationInstaller->installSchema(Array)
#4 /Sites/magento-cc-2.4.7/setup/src/Magento/Setup/Model/Installer.php(897): Magento\Setup\Model\Installer->declarativeInstallSchema(Array)
#5 [internal function]: Magento\Setup\Model\Installer->installSchema(Array)
#6 /Sites/magento-cc-2.4.7/setup/src/Magento/Setup/Model/Installer.php(388): call_user_func_array(Array, Array)
#7 /Sites/magento-cc-2.4.7/setup/src/Magento/Setup/Console/Command/InstallCommand.php(237): Magento\Setup\Model\Installer->install(Array)
#8 /Sites/magento-cc-2.4.7/vendor/symfony/console/Command/Command.php(298): Magento\Setup\Console\Command\InstallCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /Sites/magento-cc-2.4.7/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /Sites/magento-cc-2.4.7/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /Sites/magento-cc-2.4.7/vendor/magento/framework/Console/Cli.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /Sites/magento-cc-2.4.7/vendor/symfony/console/Application.php(171): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /Sites/magento-cc-2.4.7/bin/magento(23): Symfony\Component\Console\Application->run()
#14 {main}

Additional information

Install works fine without supplying a table prefix.

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @sta1r. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:


engcom-Dash commented 1 year ago

Hi @sta1r ,

Verified the issue in 2.4.7-beta1 magento instance and the issue is not reproducible,Kindly recheck the behaviour. As per the Dev Docs we are 2.4.7-beta1 enterprise edition with DB prefix and its installed successfully, refer the below screenshots:

Screenshot 2023-07-31 at 5 50 58 PM
sta1r commented 1 year ago

Strange, it works now. Sorry - I don't know what the problem was then.

River-12 commented 10 months ago

The error was again throws in 2.4.7-beta2 can anyone give me a solution how to fix it ? image

monteshot commented 5 months ago

I encountered the same issue described above while developing a custom shipping integration. The main issue is the length of the table name (Max 64). For instance: was perspective_novaposhta_counterparty_addresses_doors added the "_contact_person" And M2 handles names as perspective_novaposhta_counterparty_contact_person_addresses_doo but not as described in the DB schema. image

@engcom-Hotel @engcom-Dash I think we need to reopen the task to clarify the exception message. What do you think about it?

FYI @River-12 @sta1r

monteshot commented 5 months ago

Affects all version of M2 with db_schema.xml

nomis11uk commented 5 months ago

We are also getting the same error trying to update from 2.4.6-p4 to 2.4.7. Does any know how to fix?

nomis11uk commented 5 months ago

@monteshot @sta1r did you find a fix for the issue?

monteshot commented 5 months ago

@nomis11uk I shortened the table name. In my case

devchris79 commented 5 months ago

Magento 2.4.7 adds a new table called payment_services_order_status_data_production_submitted_hash its a bit long at 60 characters, after our prefix of 4 characters and and underscore was added it took the length to 65 and beyond Mariadb limit of 64.

So anyone with a prefix of 5 or more characters including the underscore will see this error.

I reduced the prefix size and it then installed just fine.

tibzoy commented 5 months ago

In my case, installation went well using --db-prefix=m_. Hope that works for you too.

devchris79 commented 4 months ago

This has now been fixed as pointed out by @chernenm on another thread:

The fix for this issue has just been released in scope of a new Payment Services package version 2.5.0, the package is available at repo.magento.com If you are already on 2.4.7 please run composer require magento/payment-services:2.5.0 --with-all-dependencies to get the latest version. If you are upgrading to 2.4.7 the latest package will be used automatically.

The new version "supports Adobe Commerce guidelines for the --db-prefix parameter"