Skip to content

Commit 0ff3a44

Browse files
committed
fix sqlite up for non-string legacy defaults
1 parent b2cf0ac commit 0ff3a44

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

drizzle-kit/src/cli/commands/up-sqlite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const upSqliteHandler = (out: string) => {
4545
console.log("Everything's fine 🐶🔥");
4646
};
4747

48-
const updateToV7 = (snapshot: SQLiteSchemaV6): SqliteSnapshot => {
48+
export const updateToV7 = (snapshot: SQLiteSchemaV6): SqliteSnapshot => {
4949
const ddl = createDDL();
5050
for (const table of Object.values(snapshot.tables)) {
5151
ddl.tables.push({

drizzle-kit/src/dialects/sqlite/snapshot.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
import { any, array as zArray, boolean, enum as enumType, literal, object, record, string, type TypeOf } from 'zod';
1+
import {
2+
any,
3+
array as zArray,
4+
boolean,
5+
coerce,
6+
enum as enumType,
7+
literal,
8+
object,
9+
record,
10+
string,
11+
type TypeOf,
12+
} from 'zod';
213
import { originUUID } from '../../utils';
314
import { array, validator } from '../simpleValidator';
415
import type { SQLiteDDL, SqliteEntity } from './ddl';
@@ -34,7 +45,7 @@ const column = object({
3445
primaryKey: boolean(),
3546
notNull: boolean(),
3647
autoincrement: boolean().optional(),
37-
default: string().optional(),
48+
default: coerce.string().optional(),
3849
generated: object({
3950
type: enumType(['stored', 'virtual']),
4051
as: string(),

0 commit comments

Comments
 (0)