error while applying the migrations

Hey folks here is my code https://mystb.in/37323971356998692b currently I have set DATABASE_URL to file:./dev.sqlite after generating the migrations using the drizzle-kit generate when I apply the migrations drizzle-kit migrate I get the following error
[⣷] applying migrations...LibsqlError: SQLITE_ERROR: near "(": syntax error
at mapSqliteError (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:380:16)
at executeStmt (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:285:15)
at file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:116:24
... 3 lines matching cause stack trace ...
at migrate (D:\Warbler\node_modules\src\libsql\migrator.ts:46:19) {
code: 'SQLITE_ERROR',
rawCode: 1,
[cause]: SqliteError: near "(": syntax error
at convertError (D:\Warbler\node_modules\libsql\index.js:53:12)
at Database.prepare (D:\Warbler\node_modules\libsql\index.js:123:13)
at executeStmt (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:256:28)
at file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:116:24
at Array.map (<anonymous>)
at Sqlite3Client.migrate (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:112:38)
at LibSQLSession.migrate (D:\Warbler\node_modules\src\libsql\session.ts:90:42)
at migrate (D:\Warbler\node_modules\src\libsql\migrator.ts:46:19) {
code: 'SQLITE_ERROR',
rawCode: 1
}
}
[⣷] applying migrations...LibsqlError: SQLITE_ERROR: near "(": syntax error
at mapSqliteError (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:380:16)
at executeStmt (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:285:15)
at file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:116:24
... 3 lines matching cause stack trace ...
at migrate (D:\Warbler\node_modules\src\libsql\migrator.ts:46:19) {
code: 'SQLITE_ERROR',
rawCode: 1,
[cause]: SqliteError: near "(": syntax error
at convertError (D:\Warbler\node_modules\libsql\index.js:53:12)
at Database.prepare (D:\Warbler\node_modules\libsql\index.js:123:13)
at executeStmt (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:256:28)
at file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:116:24
at Array.map (<anonymous>)
at Sqlite3Client.migrate (file:///D:/Warbler/node_modules/@libsql/client/lib-esm/sqlite3.js:112:38)
at LibSQLSession.migrate (D:\Warbler\node_modules\src\libsql\session.ts:90:42)
at migrate (D:\Warbler\node_modules\src\libsql\migrator.ts:46:19) {
code: 'SQLITE_ERROR',
rawCode: 1
}
}
can anyone help me with this
2 Replies
Maston
Maston3w ago
there is no DATE in sqlite, you could provide a runtime default like this: integer("createdAt", { mode: "timestamp" }).$default(() => new Date())
Aditya Kirad
Aditya KiradOP3w ago
but sqlite has CURRENT_TIMESTAMP I replaced DATE function with this and it worked

Did you find this page helpful?