Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails with the error "Unable to apply data patch Magento\CustomerSampleData\Setup\Patch\Data\InstallCustomerSampleData" on EE/Commerce #181

Open
xi-ao opened this issue Mar 27, 2023 · 2 comments

Comments

@xi-ao
Copy link

xi-ao commented Mar 27, 2023

Using a clean Docker stack based on the versions mentioned in the official requirements page, I always end up with the following error when trying to install the sample data:

Unable to apply data patch Magento\CustomerSampleData\Setup\Patch\Data\InstallCustomerSampleData for module Magento_CustomerSampleData. Original exception message: Rolled back transaction has not been completed correctly.

When digging up a bit, I can figure out this is caused by the following file: vendor/magento/module-customer-sample-data/fixtures/customer_profile.csv, and because it has the ID 2 hardcoded in the gender column:

firstname,lastname,email,password,dob,gender,street,city,region,country_id,postcode,telephone
Veronica,Costello,"[email protected]","[email protected]","1973-12-15",2,"[""6146 Honey Bluff Parkway"",""""]",Calder,Michigan,US,"49628-7978","(555) 229-3326"
                                                                        HERE ---^

Looking at the database, I can see that the IDs seem to have a increment step of 3 and not 1, which means that 2 cannot occur when using a single database node (typical configuration on a developer instance).

option_id attribute_id sort_order
1 58 0
4 58 1
7 58 3

(58 is the ID of th attribute gender on customers)

I guess hardcoding IDs is a bad practice anyway, so perhaps the best solution would be to use the label in that file (Female) and adapt the injection code to it.

@criskell
Copy link

any new? same here :/

@vinodsowdagar
Copy link

vinodsowdagar commented Jul 27, 2023

Somehow, modifying the value to either 1 or 4 doesn't work for me either. Only way I can make the installation work is to exclude the customer sample data installation completely by commenting out the setup line inside vendor/magento/module-customer-sample-data/Setup/Installer.php .....

    /**
     * {@inheritdoc}
     */
    public function install()
    {
        //$this->customerSetup->install(['Magento_CustomerSampleData::fixtures/customer_profile.csv']);
    }

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants