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

[DB Schema] Cannot change column type in some cases #38798

Open Nuranto opened 3 months ago

Nuranto commented 3 months ago

Summary

Changing a column type when old type uses length, and new one doesn't is currently impossible.

Examples

This :

<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

    <table name="eav_attribute">
        <column xsi:type="text" name="note" nullable="true" comment="Note"/>
    </table>

</schema>

will give Element 'column', attribute 'length': The attribute 'length' is not allowed. error

Proposed solution

This error has already been reported here : https://github.com/magento/magento2/issues/26155 But the fix was to change the original type, instead of fixing the issue. However, I won't complain of such solution for my case :)

Release note

No response

Triage and priority

m2-assistant[bot] commented 3 months ago

Hi @Nuranto. 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 3 months ago

Hi @engcom-November. 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-November commented 3 months ago

Hello @Nuranto,

Thank you for the report and collaboration!

Verified this on 2.4-develop. When trying to generate whitelist for the given db_schema throwed the below error:

Element 'column', attribute 'length': The attribute 'length' is not allowed.

Hence confirming this issue.

github-jira-sync-bot commented 3 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12169 is successfully created for this GitHub issue.

m2-assistant[bot] commented 3 months ago

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

raghuiamsingh commented 3 weeks ago

when can we expect a fix for this?