How to fix <statement> expected, got 'CURRENT_TIMESTAMP' using drizzle
Hi, I am using the following code which is intended as it generates a table using drizzle with the default text to be current timestamp and it works as expected.
import { text, integer, sqliteTable } from 'drizzle-orm/sqlite-core';
import { sql } from 'drizzle-orm';
export const posts = sqliteTable('posts', {
id: integer('id').primaryKey(),
title: text('title'),
content: text('content'),
created: text('created').notNull().default(sql`CURRENT_TIMESTAMP`),
updated: text('updated').notNull().default(sql`CURRENT_TIMESTAMP`)
});
However, Webstorm is complaining with the error <statement> expected, got ‘CURRENT_TIMESTAMP’.
How can I disable the error without having to disable sql injection completely?
Please sign in to leave a comment.
The IDE expects a valid SQLite query here; the only way to get rid of the error is disabling the js:SQL tagged string language injection in Settings | Editor | Language Injections.