Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Wrong API referenced in database migration documentation #2344

Open
derrickmehaffy opened this issue Jan 9, 2025 · 0 comments
Open
Assignees

Comments

@derrickmehaffy
Copy link
Member

Link to the documentation page or resource

https://docs.strapi.io/dev-docs/database-migrations#using-strapi-instance-for-migrations

Describe the bug

The Strapi database migration example (bottom of the page) references the entityService which is deprecated in Strapi 5 and users should use the documentService.

Additional context

No response

Suggested improvements or fixes

This code example:

module.exports = {
  async up() {
    await strapi.db.transaction(async () => {
      // Your migration code here

      // Example: creating new entries
      await strapi.entityService.create('api::article.article', {
        data: {
          title: 'My Article',
        },
      });

      // Example: custom service method
      await strapi.service('api::article.article').updateRelatedArticles();
    });
  },
};

Should be changed to use the documentService (likewise for typescript): https://docs.strapi.io/dev-docs/api/document-service

Related issue(s)/PR(s)

Support Ticket TID10727

@strapi strapi deleted a comment from github-actions bot Jan 10, 2025
@pwizla pwizla self-assigned this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants