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

feat: collection hashing for multi instance support #3276

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

GerryWilko
Copy link
Contributor

πŸ”— Linked issue

fixes #3273

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR aims to address issues related to multiple running instances of Nuxt connecting to the same collection database by optimizing the module initialization and removing the need to drop all content tables and recreate each time.

I have proposed moving the collection hash into the resolveCollection function and using the first four safe characters as part of the table name. This allows collections that have not been altered to be left untouched during initialization allowing for multiple connecting Nuxt instances to run the module without interfering with each other.

Do let me know if there is anything you would like me to change here.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

pkg-pr-new bot commented Mar 25, 2025

npm i https://pkg.pr.new/@nuxt/content@3276

commit: 5f26183

@farnabaz
Copy link
Member

Thanks @GerryWilko for the issue and PR,
Adding hash to the table's name is not an ideal thing to do. As a user, I don't like to see hashes in my table's name. Also what if two projects share the exact same collection?

Instead of adding hash suffix, we can add support for a custom table prefix. This way in tests each instance can define its own prefix. Also this would be useful in production, you can share sam database between two or more applications.
Instead of adding hash suffix

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

Successfully merging this pull request may close these issues.

Support running multiple instances on v3
2 participants