-
Notifications
You must be signed in to change notification settings - Fork 54
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
Link multiple projects to the same D1 database? #248
Comments
Thank you for your kind words! This is a very good use case and right now this is not possible and I don't have a direct workaround but this pushed me to also work on #179 as well as this is related too. I guess on top of supporting multiple databases like this: export default defineNuxtConfig({
hub: {
database: {
default: true,
users: true
}
},
}) I could support adding an existing database with: export default defineNuxtConfig({
hub: {
database: {
default: 'your-d1-id'
},
// or even simplified
database: 'your-d1-id'
},
}) What do you think? |
I think that that would be a perfect solution! I'll keep an eye on this and have just subscribed to notifications from #179 to keep up with any updates there as well. Thank you again for your help and quick response! |
Overall, it would be good if such functionality applied not only to the database, but also if different projects within one account could use the same R2 bucket or the same KV namespace. And in the long-term perspective – to add S3 methods for interacting with the R2 bucket from other accounts. |
Sorry for being so long about it @howardah So far it is possible only using the CF dashboard once you deployed your second project:
|
@atinux Will a database also be needed in Nuxt Hub Admin, and will it be possible to edit it from there? |
A |
@atinux, amazing. Thank you so much, that's perfect! Shall I close this issue as completed? |
Let's keep it open :) |
I totally agree that this would be a great feature for several use cases. @sparrow-chik-chrk It is Important to ensure that only one of the projects should own the migrations of the database. When you design your applications. It could end up being a very complicated database if both projects change the database schema. @atinux I don't know if it could be possible to fail the deploy if there already exist another project using migrations against the same database id. |
Hi, I'm just now exploring NuxtHub and am super impressed with all the work that you all have done.
I have one question for the moment however. I have two projects that I am building that will ultimately want to use the same database. One is a sort of admin app where users will edit information that will appear on the other app. For multiple reasons, that I'll not go into just here, I think it makes sense that the applications should be separated into two projects. So I'm wondering, if there's a way to specify the D1 database id so that the two applications can have access to the same data?
I tried creating a
wrangler.toml
file at the root of my project with the database name (per the wrangler configuration instructions) and that didn't seem to do the trick:Is this possible at the moment and/or are there any existing workarounds?
Thank you so much in advance!
The text was updated successfully, but these errors were encountered: