Raw SQL string to `DrizzleSQLiteSnapshotJSON`?

I'm trying to generate migrations programmatically for SQlite using drizzle-kit/api. This is the general approach I'm using:

import {
  generateSQLiteDrizzleJson,
  generateSQLiteMigration,
} from "drizzle-kit/api";
import { int, sqliteTable, text } from "drizzle-orm/sqlite-core";

const usersTable = sqliteTable("users_table", {
  id: int().primaryKey({ autoIncrement: true }),
  name: text().notNull(),
  age: int().notNull(),
  email: text().notNull().unique(),
});

const [previous, current] = await Promise.all(
  [{}, { users: usersTable }].map((schemaObject) =>
    generateSQLiteDrizzleJson(schemaObject)
  )
);

const migration = await generateSQLiteMigration(previous, current).join("\n");


The issue I'm facing is that previous expects type DrizzleSQLiteSnapshotJSON, but the plaform I'm on (val town) only allows me to get raw sql strings for previous. Is there a way to parse raw sql into DrizzleSQLiteSnapshotJSON?

Note (I asked this here as well but haven't gotten any response so reposting here)
Was this page helpful?