Skip to content

Commit

Permalink
Merge pull request #1821 from M0rgan01/add-upgrade-module-contribution
Browse files Browse the repository at this point in the history
Add upgrade module contribution part
  • Loading branch information
kpodemski authored Oct 21, 2024
2 parents bdb6ae3 + 6be8033 commit 049a5e2
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contribute/contribution-guidelines/pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ If no issue is linked to your Pull Request, maintainers might ask you to create

This field should contain links to related PRs in other repositories.

If your Pull Request modifies database structure or adds new configuration fields, you should also provide a PR for [autoupgrade module](https://github.com/PrestaShop/autoupgrade).
If your Pull Request modifies the database structure, adds new configuration fields, or is automatically assigned with the “Needs Autoupgrade PR” label, you must create a corresponding PR for the Autoupgrade module. For more information on this process, see Contributions to the [Autoupgrade module][1].

If your Pull Request needs a theme change to work, you should provide [hummingbird](https://github.com/PrestaShop/hummingbird) and [classic-theme](https://github.com/PrestaShop/classic-theme) PR.

Expand All @@ -149,3 +149,5 @@ Including automated tests (unit, integration or functional) that verify your cha
### Possible impacts

PrestaShop's QA team will not only verify the right behavior of your change but also verify that other related parts of the software are still working as expected. For example modifying a CSS class can disrupt the display of all the web pages which rely on it. Please mention all the impacts you are aware of that need to be checked in order to help QA team find and verify all of them.

[1]: {{< relref "/9/contribute/contribution-guidelines/upgrade-module" >}}
43 changes: 43 additions & 0 deletions contribute/contribution-guidelines/upgrade-module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Contributions to the Autoupgrade module
weight: 60
---

# Upgrade Contributions: Best Practices and Essential Tips

There are elements to consider if a modification has been made to the structure of the database in a contribution to the PrestaShop project, specifically a contribution to the Core.

During a contribution, if there's a change in the structure of the given database, the "Needs autoupgrade PR" label is added. It indicates that another pull request is required to ensure the proper functioning of the upgrade process to the relevant version.

![Screenshot of the Label](../../img/needs-autoupgrade-pr-label.png)

This label is the result of verifications executed on each pull request, where a comparison of stores is done against the base and your branch. If differences are found, this means a store upgrading to a version containing your changes will require its content to be migrated.

It is essential to keep the upgrade process up to date according to the changes made to the Core to ensure the proper functioning of upgrades for different versions of PrestaShop.

## How do we determine which content is affected and what needs to be added?

When there's a modification to the `db-structure.sql` file or if a Doctrine entity has been modified, added, or deleted, it impacts the database structure. Modifying the list of hooks, feature flags, new configurations (or generally new base fixtures) has consequences on the upgrade process as well.

These changes can affect how the application interacts with the database and how upgrade procedures are handled.

It's important to consider these aspects when contributing to ensure a smooth upgrade experience for users.

{{% notice tip %}}
The core command `prestashop:schema:update-without-foreign --dump-sql` allows you to retrieve the queries needed to update the database according to changes made to the Doctrine entities.

It is also possible to retrieve a diff of SQL dumps made in the summary of the GitHub actions `Check the label 'Needs autoupgrade PR'` if the label was added automatically.
{{% /notice %}}

## Autoupgrade Module contribution

Also known as the “1-click upgrade module”, the autoupgrade module is responsible for running the upgrade process on PrestaShop stores. This is when upgrade migration files should be added if the pull request is labeled “Needs Autoupgrade PR.”

Contributions related to the upgrade process should be targeted towards the [Autoupgrade repository](https://github.com/PrestaShop/autoupgrade), and more specifically in one of these [upgrade scripts](https://github.com/PrestaShop/autoupgrade/tree/dev/upgrade/sql).
Reading the Project Modules section will explain the basics of contributing to the [PrestaShop module][1]

## Changes related to modules

Modules manage their own table and columns and there is currently no automatic checking of modules upgrade scripts requirement. Migration files must be joined to the pull request that makes changes to the database.

[1]: {{< relref "/9/contribute/contribution-guidelines/project-modules" >}}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ If something is wrong, Prestonbot will write a comment in the pull request to te

Issuebot (based on the [probot framework](https://github.com/probot/probot)) is another bot that automates our issue/PR workflow. It will make sure your Pull Request metadata, such as labels or Kanban cards, are valid.

### “Needs Autoupgrade PR” automated label

If your Pull Request modifies the database structure, adds new configuration fields, or is automatically assigned with the “Needs Autoupgrade PR” label, you must create a corresponding PR for the Autoupgrade module. For more information on this process, see Contributions to the [Autoupgrade module][1].

## The code review

Your Pull Request will be reviewed by a Core maintainer.
Expand Down Expand Up @@ -84,3 +88,5 @@ After the Pull Request has finally passed the QA validation, it is merged in the
---

_(This article was originally published on our blog: [What Happens To Pull Requests After They Are Submitted](https://build.prestashop-project.org/news/the-review-process/))_

[1]: {{< relref "/9/contribute/contribution-guidelines/upgrade-module" >}}
Binary file added contribute/img/needs-autoupgrade-pr-label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 049a5e2

Please sign in to comment.