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?

2

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.

0

I'd love to see an option to leave syntax highlighting on but disable checks.

0

Please vote for WEB-67195 to get notified of any progress with it.

0

请先登录再写评论。