Closed MO-Lewis closed 1 year ago
I had this issue. I was able to get past it by first upgrading to the latest version 3 of strapi first (3.6.11). Then migrate that db to version 4. I still ran into one issue here migration-scripts/v3-sql-v4-sql/migrate/migrateFiles.js:54:57. I just removed the offending code ( || related_type) for now and haven't had a chance to dig into yet as I want to do some smoke test to make sure it worth proceeding. I know I was frustrated by this so I hope this helps you and please share any findings. Thanks.
I have exactly the same problem. Did you find any solution?
I'm using stapi and postgresql and have a similar issue, this is the message: error: insert into "public"."admin_permissions" ("action", "conditions", "created_at", "fields", "id", "properties", "subject", "updated_at") values ($1, $2, $3, $4, $5, $6, $7, $8),($9, $10, $11, $12, $13, $14, $15, $16)
Be sure to first upgrade to the latest version of 3 of strapi as I mentioned above. That was my issue. The incremental step created the missing column then I was able to upgrade to version 4.
This will fix the issue by using either the properties column, and if it does not exist it will try to read the fields column from the old db
This will fix the issue by using either the properties column, and if it does not exist it will try to read the fields column from the old db
Hi @abanchev,
Can you let me know in which file do we need to do the above changes ?
Hi All,
Can anyone let me know how to solve this issue. I am getting this error after doing Strapi data migration from SQL v3 to SQL V4
@Priya2994
Here is a patch
diff --git a/v3-sql-v4-sql/migrate/helpers/adminHelpers.js b/v3-sql-v4-sql/migrate/helpers/adminHelpers.js
index fce9d12..6a1d00c 100644
--- a/v3-sql-v4-sql/migrate/helpers/adminHelpers.js
+++ b/v3-sql-v4-sql/migrate/helpers/adminHelpers.js
@@ -47,11 +47,11 @@ async function migrateAdminPermissions() {
const items = await dbV3(resolveSourceTableName(source))
.limit(BATCH_SIZE)
.offset(page * BATCH_SIZE);
- const migratedItems = migrateItems(items, ({ role, ...item }) => ({
+ const migratedItems = migrateItems(items, ({ role, fields, properties, ...item }) => ({
...item,
action: migrateUids(item.action),
subject: migrateSubject(item.subject),
- properties: migrateProperties(item.properties),
+ properties: migrateProperties(properties ?? { fields: JSON.parse(fields) }),
conditions: isPGSQL ? JSON.stringify(item.conditions) : item.conditions,
}));
const roleLinks = items.map((item) => ({
Bug report
Required System information
v16.17.0
v8.15.0
v3.5.0
v4.5.5
MySQL
MySQL
Windows 10 64-bit
.env
files)Describe the bug
This appears to be the same issue as this bug from last year: https://github.com/strapi/migration-scripts/issues/10
This issue was never properly solved and was closed due to inactivity. As all of the code that I'm using has been provided by the Strapi team, I'm hoping that this issue will provide a reproducible example, so the team can provide an explanation for the issue, and potentially a fix. For any repos / npm packages I use, I aim to provide commit IDs and version numbers.
This also looks like it might be related to https://github.com/strapi/migration-scripts/issues/19
After using the Strapi example repo to migrate the demo strapi application from V3 to V4 via codemods (and following the livestream: https://www.youtube.com/watch?v=NSvdQKVvV9k), I've cloned the migration-scripts repo and followed the data migration livestream (https://www.youtube.com/watch?v=kdxivJjjVhY).
After filling in the env files and specifying my targets, I run the migration script, but then get the following error:
Looking at previous issues which provide a similar error to this, people have recommended to open the target
old_data.db
file and drop the "fields" column in the V3 "strapi_permission" table. Doing so will allow the migration to run its course and "successfully" complete. However, if I then try to run "npm run develop", I get this:Steps to reproduce the behavior
package.json
of thev3-sql-v4-sql
folder, you should specify"@vscode/sqlite3": "^5.1.2-vscode"
. I had to upgrade this package due to the following issue with this package: https://github.com/microsoft/vscode/issues/152839.npm install
the rest of the packages inv3-sql-v4-sql
, as normal.old_data.db
.data.db
); I didn't create any admin users prior to running the script.v3-sql-v4-sql
, copy the.env.sqlite.example
file and fill out the required info, including where your v3 and v4 database file is located. Save this copied file as.env
.v3-sql-v4-sql
folder, runnpm run start
.fields
column within thestrapi_permission
column. Re-run the migration script withnpm run start
. It should now claim it's successfully completed.npm run develop
. You should now see the second error I've pasted.Expected behavior
The database successfully migrates, all permissions are preserved, and I can use Strapi V4 with my migrated data.
Screenshots
Above is a screenshot of node_modules\@strapi\admin\server\services\content-type.js:167:21, where the error after "successfully migrating" occurs. I'd like to draw attention to
properties: { fields }
. I'm unsure how deleting thefields
column works for other users which face a similar issue to this, as Strapi then looks for the missing columnMore screenshots can be provided on request.
Code snippets
Not applicable, but can provide on-request.
Additional context
Not applicable, but can provide on-request.