dylanblokhuis/kysely-bun-sqlite

Migrations with modifications seems to fail

Closed this issue · 1 comments

Thanks for this awesome project! I'm trying to get a project running locally with sqlite and this was just what I needed.

It seems to work fine for most migrations, but I'm getting stuck on migrations that alter existing tables. This migration is for instance causing the migrations to fail:

export async function up(db: Kysely<KyselyDatabase>): Promise<void> {
  await db.schema
    .alterTable("users")
    .modifyColumn("picture", "varchar(2083)")
    .execute();
}

This is the error I get:

migrating...
failed to execute migration "m5_userProfile"
failed to migrate
188 |     }
189 |     var arg0 = params[0];
190 |     return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0)) ? SQL.run(this.#handle, query, params) : SQL.run(this.#handle, query, ...params);
191 |   }
192 |
193 |   prepare(query, params, flags) {
                     ^
error: near "modify": syntax error
      at prepare (bun:sqlite:193:18)
      at executeQuery (/Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely-bun-sqlite/dist/index.cjs:84:17)
      at /Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:33
      at /Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:51
      at /Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/driver/single-connection-provider.js:27:21
      at #run (/Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/driver/single-connection-provider.js:26:15)
      at /Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/driver/single-connection-provider.js:14:24
      at provideConnection (/Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/driver/single-connection-provider.js:10:28)
      at /Users/markusahlstrand/Projects/sesamy/auth/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:21
      ```
      
      Any idea what the issue might be?

I realized that this actually is a limitation of the sqlite database and not bun or the adapter, so it seems to be working as it should. Thanks!