Drizzle | SQL Toggle 값
PostgreSQL
MySQL
SQLite
This guide assumes familiarity with:
컬럼 값을 토글하려면 아래와 같이 update().set() 메서드를 사용할 수 있습니다:
import { eq, not } from 'drizzle-orm';
const db = drizzle(...);
await db
.update(table)
.set({
isActive: not(table.isActive),
})
.where(eq(table.id, 1));update "table" set "is_active" = not "is_active" where "id" = 1;MySQL과 SQLite에는 boolean 타입이 없다는 점에 유의하세요. MySQL은 tinyint(1)을 사용합니다. SQLite는 정수 0 (false)과 1 (true)을 사용합니다.