Skip to content

migration error #1321

@kelbyfaessler

Description

@kelbyfaessler

Using Turso with drizzle + sveltekit. Sveltekit has import aliases like $env, $lib and for that reason, I run scripts using vite-node so imports resolve.

I created a migration and am attempting to migrate using drizzles migrate() function. Here is the libsql/hrana error.

> vite-node --options.transformMode.ssr='/.*/' src/lib/server/migrate.ts

Running migrations...
<project>/node_modules/@libsql/client/lib-esm/hrana.js:264
        return new __vite_ssr_import_1__.LibsqlError(e.message, code, undefined, e);
               ^

LibsqlError: SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None": syntax error at (5, 37)
    at mapHranaError (<project>/node_modules/@libsql/client/lib-esm/hrana.js:257:16)
    at HttpTransaction.batch (<project>/node_modules/@libsql/client/lib-esm/hrana.js:105:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at <project>/node_modules/src/sqlite-core/dialect.ts:799:7
    at LibSQLSession.transaction (<project>/node_modules/src/libsql/session.ts:86:19)
    at SQLiteAsyncDialect.migrate (<project>/node_modules/src/sqlite-core/dialect.ts:795:3)
    at <project>/src/lib/server/migrate.ts:8:1
    at ViteNodeRunner.directRequest (file://<project>/node_modules/vite-node/dist/client.mjs:328:5)
    at ViteNodeRunner.cachedRequest (file://<project>/node_modules/vite-node/dist/client.mjs:186:14)
    at ViteNodeRunner.executeFile (file://<project>/node_modules/vite-node/dist/client.mjs:154:12) {
  code: 'SQL_PARSE_ERROR',
  rawCode: undefined,
  [cause]: [ResponseError: SQL string could not be parsed: near LP, "None": syntax error at (5, 37)] {
    code: 'SQL_PARSE_ERROR',
    proto: {
      message: 'SQL string could not be parsed: near LP, "None": syntax error at (5, 37)',
      code: 'SQL_PARSE_ERROR'
    }
  }
}

Node.js v18.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions