nuxt-hub / feedback

Share your feedback about the NuxtHub platform.
https://admin.hub.nuxt.com
5 stars 0 forks source link

Migration with raw SQL does not works #15

Closed Barbapapazes closed 2 months ago

Barbapapazes commented 2 months ago

Describe the bug

I'm trying to run migration in dev using this recipe, https://hub.nuxt.com/docs/recipes/hooks, but it does not works.

To Reproduce

https://github.com/Barbapapazes/nuxt-hub-raw-sql

Expected behavior

I did not expect the error but a working migration step, like when I use Drizzle where everything works fine.

Desktop (please complete the following information):

Dependencies: "@nuxthub/core": "^0.5.14", "nuxt": "^3.11.2", "vue": "^3.4.21", "vue-router": "^4.3.0"

Dev Dependencies: "wrangler": "^3.53.0"

Atinux commented 2 months ago

What is the error your are receiving @Barbapapazes ?

Barbapapazes commented 2 months ago

What is the error your are receiving @Barbapapazes ?

This one

ERROR  [nitro] [unhandledRejection] D1_EXEC_ERROR: Error in line 1: CREATE TABLE IF NOT EXISTS todos (: incomplete input

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (server/plugins/migrations.ts:5:1)
at async Promise.all (index 0)
at <anonymous> (node_modules/.pnpm/@nuxthub+core@0.5.14_ioredis@5.4.1_nuxt@3.11.2_@parcel+watcher@2.4.1_@types+node@20.12.7_@uno_v6ufku3kw6jhvrpovvvt7rg5kq/node_modules/@nuxthub/core/dist/runtime/ready.dev.mjs:5:3)
Atinux commented 2 months ago

I think it's because you cannot use \n inside the query.

Could you try with removing the \n in your SQL statement? If so, we should add a .replace(/\n/g, '') to the end of the statement.

Barbapapazes commented 2 months ago

I think it's because you cannot use \n inside the query.

Could you try with removing the \n in your SQL statement? If so, we should add a .replace(/\n/g, '') to the end of the statement.

It works now!

Atinux commented 2 months ago

Updated the documentation about it, thanks for reporting it @Barbapapazes 😊