Fix M2 issue when using the same DB with WordPress
The problem
Error message when running setup:upgrade
:
“Cannot process definition to array for type tinytext”
Or:
“Types char is not declared”
The problem is Magento 2 doesn’t support some data types, it doesn’t allow them in its DB:
- enum
- time
- mediumint
- tinytext
- char
My suggestion: Don’t ever use the same database with WordPress!!!
How to fix?
1. The painful way:
Step 1: Find the table that contains the disallow type (using PHPMyAdmin)
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE ='mediumint' AND TABLE_SCHEMA = 'your_db_name'
Step 2: Replace the types mediumint
by int
.
Step 3: Repeat step 1 with these types:
- tinytext -> text
- char -> varchar
- time -> currently I don’t know what type can replace time type without causing an error.
- enum -> Please use “The temporary way” because there is no alternative type that can replace enum.
Step 4: Try to run setup:upgrade
again.
2. The temporary way:
Disable the exception follow this answer. Please note that this way doesn’t fix the issue because it just temporarily bypasses it.