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.37k stars 9.28k forks source link

Add "algorithm" support to db_schema.xml #38848

Open qsolutions-pl opened 2 weeks ago

qsolutions-pl commented 2 weeks ago

Description

A lot of 3rd party extensions add extra columns to core tables and it is prolonging the deployment process and causing a huge downtime for production sites.

I recommend to add a new attribute to XML node in the db_schema.xml to support MySQL ALGORITHM=INPLACE feature that does not produce this downtime. Thanks @toonvd for the idea on #magechat.

Example code:

<table name="sales_order" resource="sales" comment="Sales Flat Order">
    <column xsi:type="smallint" name="my_field" unsigned="false" nullable="true" identity="false"
        algorithm="INPLACE" comment="My Custom Field"/>
</table>

will produce following SQL:

ALTER TABLE sales_order
ADD COLUMN my_field smallint DEFAULT NULL,
ALGORITHM=INPLACE, LOCK=NONE;

Expected behavior

Change the SQL query used to modify table structure:

ALTER TABLE sales_order
ADD COLUMN my_field smallint DEFAULT NULL,
ALGORITHM=INPLACE, LOCK=NONE;

Benefits

Additional information

No response

Release note

No response

m2-assistant[bot] commented 2 weeks ago

Hi @qsolutions-pl. 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: