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

We should be able to generate new storeviews and expect them to exist while executing data patches during the installation of a Magento shop #33890

Open
1 of 5 tasks
hostep opened this issue Aug 23, 2021 · 7 comments
Labels
Area: Framework feature request Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Progress: ready for grooming Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@hostep
Copy link
Contributor

hostep commented Aug 23, 2021

Summary (*)

We have a specific case where we want to run data patches while looping over storeviews during bin/magento setup:install, and we expect that the storeviews that are defined in the app/etc/config.php file should already exist in the database before the data patches are being run.

We can accomplish this during bin/magento setup:upgrade when the database already exists and afterwards adding a new data patch. But in my opinion this should also work during bin/magento setup:install on a fresh installation.

So I think this sort order of steps during setup:install makes sense:

  1. generate the database structure
  2. setup the storeviews as defined in the app/etc/config.php file
  3. now execute the data patches

Examples (*)

  • Have a Magento filestructure ready
  • Have a file app/etc/config.php containing some websites/stores/storeviews
  • Have a custom module that contains a data patch that loops over all the storeviews and outputs the storeview code or something like that
  • Now execute bin/magento setup:install ...

It's expected that the output contains the storeview codes of all storeviews defined in the app/etc/config.php file and that the websites/stores/storeviews are created in the database before the data patch gets executed.
Currently we only get the default storeview that Magento comes with.

Proposed solution

Generate storeviews after generating database structure and before executing data patches.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@hostep hostep added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Aug 23, 2021
@m2-assistant
Copy link

m2-assistant bot commented Aug 23, 2021

Hi @hostep. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@nuzil
Copy link
Contributor

nuzil commented Aug 25, 2021

Hi @hostep, agree, its a valid point.

@m2-assistant
Copy link

m2-assistant bot commented Oct 29, 2021

Hi @engcom-Hotel. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

Hi @hostep

Thank you for reporting the issue!

We tried to reproduce it on Magento 2.4-develop and we are able to reproduce it.

Steps followed to reproduce.
Added new store entry in config.php

'scopes' => [
    'websites' => [
        'admin' => [
            'website_id' => '0',
            'code' => 'admin',
            'name' => 'Admin',
            'sort_order' => '0',
            'default_group_id' => '0',
            'is_default' => '0'
        ],
        'base' => [
            'website_id' => '1',
            'code' => 'base',
            'name' => 'Main Website',
            'sort_order' => '0',
            'default_group_id' => '1',
            'is_default' => '1'
        ]
    ],
    'groups' => [
        [
            'group_id' => '0',
            'website_id' => '0',
            'name' => 'Default',
            'root_category_id' => '0',
            'default_store_id' => '0',
            'code' => 'default'
        ],
        [
            'group_id' => '1',
            'website_id' => '1',
            'name' => 'Main Website Store',
            'root_category_id' => '2',
            'default_store_id' => '1',
            'code' => 'main_website_store'
        ]
    ],
    'stores' => [
        'admin' => [
            'store_id' => '0',
            'code' => 'admin',
            'website_id' => '0',
            'group_id' => '0',
            'name' => 'Admin',
            'sort_order' => '0',
            'is_active' => '1'
        ],
        'default' => [
            'store_id' => '1',
            'code' => 'default',
            'website_id' => '1',
            'group_id' => '1',
            'name' => 'Default Store View',
            'sort_order' => '0',
            'is_active' => '1'
        ],
        'test1' => [
            'store_id' => '2',
            'code' => 'test',
            'website_id' => '1',
            'group_id' => '1',
            'name' => 'Test Store View',
            'sort_order' => '1',
            'is_active' => '1'
        ]
    ]
]

Then run setup upgrade.
Config entry is getting read while setup upgrade.

As per the issue, scope configuration should read from config.php while running the install command.

Thank you

@engcom-Hotel engcom-Hotel added Reported on 2.4.x Indicates original Magento version for the Issue report. Area: Framework Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Dec 1, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Dec 1, 2021
@m2-community-project m2-community-project bot added this to In Progress in Feature Requests Backlog Dec 1, 2021
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-1916 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Dec 1, 2021

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@m2-community-project m2-community-project bot moved this from In Progress to Ready for Grooming in Feature Requests Backlog Dec 1, 2021
@github-jira-sync-bot github-jira-sync-bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Dec 20, 2021
@engcom-Hotel engcom-Hotel removed the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Dec 20, 2021
@hostep
Copy link
Contributor Author

hostep commented Dec 24, 2021

Hi @engcom-Hotel: I think you may have misunderstood the issue. Could you read it again? It has to do with bin/magento setup:install not bin/magento setup:upgrade.
If it's not very clear my explanation, could you point me to the part that needs extra explanation? Thanks!

Or maybe I misunderstood your comment, that's also possible, sorry if that's the case 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework feature request Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Progress: ready for grooming Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Feature Requests Backlog
  
Ready for Grooming
Development

No branches or pull requests

4 participants