magendoo/module-declarative-enum-support

Lets Magento 2 declarative schema (setup:upgrade) read past MySQL ENUM/SET columns in third-party database tables instead of failing with 'Cannot process definition to array for type enum'.

Maintainers

Package info

github.com/magendooro/magento2-declarative-enum-support

Type:magento2-module

pkg:composer/magendoo/module-declarative-enum-support

Transparency log

Fund package maintenance!

magendoo.ro

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-18 14:43 UTC

This package is auto-updated.

Last update: 2026-07-18 14:47:53 UTC


README

Lets bin/magento setup:upgrade succeed when the Magento database contains third-party tables with MySQL ENUM or SET columns.

The problem

Magento's declarative schema reads every table in the database — not just the tables declared in db_schema.xml files. If any table contains an ENUM or SET column, setup:upgrade aborts:

Upgrade failed: Cannot process definition to array for type enum

and, once past that, a second failure in the DTO layer:

Types enum is not declared

This bites any installation whose database is shared with other applications (microservices, ETL pipelines, reporting tools) or contains tables left behind by legacy extensions — Magento itself never creates ENUM/SET columns, but it refuses to read past anyone else's.

What this module does

It registers handlers for the enum and set column types in the two declarative-schema registries that lack them:

Registry Class Handler
definitionProcessors Magento\Framework\Setup\Declaration\Schema\Db\DefinitionAggregator Pass-through processor (Model/EnumDefinition.php)
typeFactories Magento\Framework\Setup\Declaration\Schema\Dto\ElementFactory Stock Blob DTO factory

Tables that are not declared in any db_schema.xml are never diffed, so declarative schema only needs to parse their columns without crashing — it never generates DDL for them. Your third-party tables are read, ignored, and left untouched.

Declaring an ENUM column in a db_schema.xml remains unsupported: the pass-through processor throws a LogicException if declarative schema ever tries to render one, so misuse fails loudly instead of producing broken DDL.

Installation

Via composer (VCS repository)

composer config repositories.magendoo-declarative-enum-support vcs https://github.com/magendooro/magento2-declarative-enum-support
composer require magendoo/module-declarative-enum-support
bin/magento module:enable Magendoo_DeclarativeEnumSupport
bin/magento setup:upgrade

Via app/code

mkdir -p app/code/Magendoo
git clone https://github.com/magendooro/magento2-declarative-enum-support app/code/Magendoo/DeclarativeEnumSupport
bin/magento module:enable Magendoo_DeclarativeEnumSupport
bin/magento setup:upgrade

Compatibility

  • Magento Open Source / Adobe Commerce 2.4.x (tested on 2.4.9)
  • PHP 8.1+

Maintenance note (important)

A module's di.xml argument replaces — it does not merge with — the same argument declared in the primary config app/etc/di.xml; primary and module configs are combined per-argument, not per-array-item. This module therefore ships full copies of the typeFactories and definitionProcessors registries with enum/set appended.

After upgrading Magento, diff this module's etc/di.xml against your app/etc/di.xml: if a new core release adds column types to either registry, they must be re-synced here, otherwise the new types would be masked.

License

MIT