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

Compatibility issue M2.3/M2.4 and DB engine - column definition "order_id" / "entity_id" are different #9

Open
mihaimatei opened this issue Mar 23, 2023 · 1 comment

Comments

@mihaimatei
Copy link

Running setup:upgrade, on the below mentioned environment, throws following output and breaks when upgrading modules:
Column definition "order_id" and reference column definition "entity_id" are different in tables "sales_order_tax_scheme" and "sales_order"

Environment encountered on :

  • Magento 2.3.7-p4
  • mysql Ver 15.1 Distrib 10.3.38-MariaDB
  • PHP 7.4.33

Debug findings by dumping from vendor/magento/framework/Setup/Declaration/Schema/Declaration/ValidationRules/IncosistentReferenceDefinition.php:assertDefinitionEqual() checks:

assertUnassigned: bool(true)
assertIntegerEquals: bool(false)
assertStringBinariesEqual: bool(true)

column getPadding = 11
referenceColumn getPadding = 10

BTW: this method/file also contained another bug that is present until M2.4.3: magento/magento2#32309

So it all comes down to this M2.3/M2.4 change noticed here: https://magento.stackexchange.com/questions/330646/declarative-schema-uses-padding-in-2-3-gone-in-2-4-do-we-have-to-use-it

For the moment, I 'fixed' it by adding padding="10" into db_schema.xml:

<column xsi:type="int" name="order_id" unsigned="true" nullable="false" identity="false" padding="10"
                comment="Order ID"/>

but I don't know if this would break on environments with MySQL8 or MariaDB10.4 as hinted by the core changing commit title: magento/magento2@159b377

@gwharton
Copy link
Owner

Thanks for bringing this to my attention, I was unaware of the incompatability.

Thanks for investigating so thoroughly.

I'm not really sure what to do with this one, as it would seem to be incompatible with the current releases.

I'll just leave the issue open, so that if others run into the problem, they can see the workaround.

Thanks again.

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

2 participants