© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•5mo ago
Nico

Raw SQL string to `DrizzleSQLiteSnapshotJSON`?

I'm trying to generate migrations programmatically for SQlite using
drizzle-kit/api
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");
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
previous
expects type
DrizzleSQLiteSnapshotJSON
DrizzleSQLiteSnapshotJSON
, but the plaform I'm on (val town) only allows me to get raw sql strings for
previous
previous
. Is there a way to parse raw sql into
DrizzleSQLiteSnapshotJSON
DrizzleSQLiteSnapshotJSON
?

Note (I asked this here as well but haven't gotten any response so reposting here)
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Get raw SQL string with parameters
Drizzle TeamDTDrizzle Team / help
2y ago
pgTable - raw sql
Drizzle TeamDTDrizzle Team / help
3y ago
Run Raw SQL with sql``
Drizzle TeamDTDrizzle Team / help
16mo ago