-
Notifications
You must be signed in to change notification settings - Fork 60
Migrate strapi_permission (v3) into admin_permissions (v4) - column "fields" of relation "admin_permissions" does not exist (again) and "Cannot read properties of null (reading 'fields')" #83
Comments
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: |
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. |
Hi @abanchev, Can you let me know in which file do we need to do the above changes ? |
Here is a patch
|
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: #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 #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
yarn seed
outputs "Failed to move C:\test\demoMigration\data\uploads to public\uploads" PaulBratslavsky/demoMigration#1 (comment)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: error D:\vscode-main\node_modules\@vscode\sqlite3: Command failed. microsoft/vscode#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.
The text was updated successfully, but these errors were encountered: