strapi / strapi

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.
https://strapi.io
Other
60.61k stars 7.57k forks source link

core::5.0.0-discard-drafts migration fails when not using i18n #20225

Open laurenskling opened 2 weeks ago

laurenskling commented 2 weeks ago

Bug report

Required System information

Environment: development OS: darwin-arm64 Strapi Version: 5.0.0-beta.5 Node/Yarn Version: yarn/1.22.19 npm/? node/v18.20.2 darwin arm64 Edition: Community Database: sqlite

Describe the bug

Starting beta.5 runs migration core::5.0.0-discard-drafts thats crashes on a missing locale field

Steps to reproduce the behavior

  1. have a strapi 4 without i18n
  2. install beta 5
  3. start
  4. crash

Expected behavior

No crash

n-alonso commented 1 week ago

Hi @laurenskling ,

I am not able to reproduce the in 5.0.0-beta.5. Im also in a mac, using yarn 1.22, node 18, SQLite and upgraded from v4@latest without i18. yarn develop still works just fine and I am able to create and delete content.

Also your reproduction steps are not very descriptive, please in the future try to be as explicit as possible.

I will mark this issue as 'unable to reproduce' until you provide further steps.

EDIT: Also, in addition, i18 is a required package in v5 as entities are now grouped as 'documents' which include also locales.

github-actions[bot] commented 1 week ago

This is a templated message

Hello @laurenskling,

Thank you for reporting this bug, however we are unable to reproduce the issue you described given the information we have on hand. Can you please create a fresh project that you are able to reproduce the issue in, provide clear steps to reproduce this issue, and either upload this fresh project to a new GitHub repo or compress it into a .zip and upload it on this issue?

We would greatly appreciate your assistance with this, by working in a fresh project it will cut out any possible variables that might be unrelated. Please note that issues labeled with status: can not reproduce will be closed in 14 days if there is no activity.

Thank you!

laurenskling commented 1 week ago

Hi Nicolas, thanks for taking the time to debug this. Sorry for my limited bug report. Somewhere I was sure this migration just forgot about v4 working without having i18n turned on and it just failed to work with that use case. But you mention that you are able to migration from a v4 without i18n, that changes the situation. My error:

â ™ Loading Strapi{ event: 'migrating', name: 'core::5.0.0-discard-drafts' }
[ERROR]  There seems to be an unexpected error, try again with --debug for more information 

MigrationError: Migration core::5.0.0-discard-drafts (up) failed: Original error: select `t0`.`id`, `t0`.`document_id`, `t0`.`locale` from                  
`documents_document` as `t0` where (`t0`.`published_at` is not null) order by `t0`.`id` asc limit 1000 - no such column: t0.locale                          
at /Users/laurenskling/sites/strapi5/node_modules/umzug/lib/umzug.js:151:27                                                                                
at async Umzug.runCommand (/Users/laurenskling/sites/strapi5/node_modules/umzug/lib/umzug.js:107:20)                                                       
at async Object.up (/Users/laurenskling/sites/strapi5/node_modules/@strapi/database/dist/index.js:6239:7)                                                  
at async Object.up (/Users/laurenskling/sites/strapi5/node_modules/@strapi/database/dist/index.js:6263:11)                                                 
at async Object.sync (/Users/laurenskling/sites/strapi5/node_modules/@strapi/database/dist/index.js:2211:9)                                                
at async Strapi.bootstrap (/Users/laurenskling/sites/strapi5/node_modules/@strapi/core/dist/Strapi.js:328:5)                                                
at async Strapi.load (/Users/laurenskling/sites/strapi5/node_modules/@strapi/core/dist/Strapi.js:294:5)                                                     
at async Module.develop (/Users/laurenskling/sites/strapi5/node_modules/@strapi/strapi/dist/node/develop.js:177:28)                                         
at async action (/Users/laurenskling/sites/strapi5/node_modules/@strapi/strapi/dist/cli/commands/develop.js:18:5)                                           
at async Command.parseAsync (/Users/laurenskling/sites/strapi5/node_modules/commander/lib/command.js:923:5)                                                 

My situation:

Edit: I got confused by the from documents_document.. This is not Strapi Documents. I have a content type called Document in my Documents plugin 🤷 If i disable that plugin, it just errors on the next content with draftAndPublish enabled

laurenskling commented 1 week ago

By the way, I am talking about the migration. If I start without a database, yes it boots and you can work. But thats not the point. The point is the migration called core::5.0.0-discard-drafts when I have content.

derrickmehaffy commented 1 week ago

By the way, I am talking about the migration. If I start without a database, yes it boots and you can work. But thats not the point. The point is the migration called core::5.0.0-discard-drafts when I have content.

@laurenskling we aren't to the point of being ready for testing migrations from v4 yet. We don't expect to be able to do that until probably around May 22nd or so.

laurenskling commented 1 week ago

Thanks @derrickmehaffy , I guess we can keep this open until testing of migration starts then :)