core
core copied to clipboard
Nuxt Devtools Hub Database SQL Runner doesn't create indexes
Try creating a unique index using the Nuxt Devtools Hub Database SQL Runner.
E.g. the below query doesn't give any error, but doesn't create the index as well.
CREATE UNIQUE INDEX users_email_key ON users(email);
Is there some way to run the wrangler commands to run D1 queries in the terminal in a NuxtHub project? To be specific, can I execute the below command for interacting with the local DB?
bunx wrangler d1 execute <db_name> --local --file=./schema.sql
If yes, then what should be the DB name? I tried default and ran the command from the root folder and got the below error:
✘ [ERROR] Couldn't find a D1 DB with the name or binding 'default' in wrangler.toml.
And running the command from .data/hub (with modified file path) folder creates a new local database (not visible to Nuxt Devtools).
This is an issue related to Drizzle Studio, I contacted the team and should be fixed very soon. Will keep you updated when fixed.
This should be fixed now @ra-jeev
Can you confirm?
Just tested it, and it works fine now.
Thank you @Atinux 🙏
Also, is it possible to do this 👇 right now?
any way to run the wrangler commands to run D1 queries in the terminal in a NuxtHub project? If yes, how?
@ra-jeev Sadly It is not working with the default configuration, because wrangler force a specific directory for local. However you can make it work by setting hub.dir = '.data/hub/v3' and using below command
npx wrangler d1 execute DB -c .data/hub/v3/wrangler.toml --local --file=./schema.sql --persist-to=.data/hub
@Atinux It seems that wrangler hard-coded v3 directory and there is no way to change that via config. WDYT about moving default hub directory from .data/hub to .data/hub/v3. With this change everyone be able to run wrangler command just like above command. Its' shame that wrangler force v3
@ra-jeev Sadly It is not working with the default configuration, because wrangler force a specific directory for local. However you can make it work by setting
hub.dir = '.data/hub/v3'and using below commandnpx wrangler d1 execute DB -c .data/hub/v3/wrangler.toml --local --file=./schema.sql --persist-to=.data/hub@Atinux It seems that wrangler hard-coded
v3directory and there is no way to change that via config. WDYT about moving default hub directory from.data/hubto.data/hub/v3. With this change everyone be able to run wrangler command just like above command. Its' shame that wrangler forcev3
Thanks for the heads up @farnabaz. Will test it out and revert.