migration-scripts
migration-scripts copied to clipboard
Cannot read properties of undefined (reading 'includes')
Bug report
Required System information
- Node.js version: 16.13.2
- NPM version: 8.1.2
- Source Strapi version: 3.6.8
- Target Strapi version: 4.3.8
- Source Database: mysql
- Target Database: mysql
- Operating system: OSX
- Which script are you running: v3-sql-v4-sql
Describe the bug
When running the script, the script aborts with the following error: const v3RelationTables = tables.filter((t) => t.includes("__")); TypeError: Cannot read properties of undefined (reading 'includes')
Steps to reproduce the behavior
- Go to 'nvm use 16'
- Run $ yarn
- Run $ yarn start
- See error
Screenshots
Code snippets
const v3RelationTables = tables.filter((t) => t.includes("__"));
Additional context
Before starting the script, I had to adjust certain columns in the table to be compliant with the snake_case.
I'm experiencing the same issue, apparently some tables are showing up as "undefined", which causes the the migration script to stop.
System information
- Node.js version: 14.20.1
- NPM version: 6.14.17
- Source Strapi version: 3.6.8
- Target Strapi version: 4.3.8
- Source Database: mysql
- Target Database: mysql
- Operating system: OSX
- Which script are you running: v3-sql-v4-sql
It appear that this is a case issue. I was able to resolve this by renaming all instances of "table_name" to "TABLE_NAME", (3) in total and found in:
- index.js
- migrateComponents.js
- relationHelpers.js
Hi, what version of mysql (mariadb) are you using? I'm not able to reproduce this error. In the meantime I created fix in way you proposed viz #55
I'm on version 2.18.1 (npm)
And the database itself? Im using mariadb:10.5.8
mysql 8.0.28
Okey, I will test it also on that, thanks!