OR 조건 대신 IN 연산자를 사용하도록 일부 SQL 쿼리 수정

This commit is contained in:
static
2026-01-16 10:24:32 +09:00
parent cb5105a355
commit d8e18fb1d3
3 changed files with 4 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ export const getAllValidClientMeks = async (userId: number, clientId: number) =>
.selectAll() .selectAll()
.where("client_master_encryption_key.user_id", "=", userId) .where("client_master_encryption_key.user_id", "=", userId)
.where("client_master_encryption_key.client_id", "=", clientId) .where("client_master_encryption_key.client_id", "=", clientId)
.where((eb) => eb.or([eb("state", "=", "active"), eb("state", "=", "retired")])) .where("state", "in", ["active", "retired"])
.execute(); .execute();
return clientMeks.map( return clientMeks.map(
({ user_id, client_id, version, state, encrypted_key, encrypted_key_signature }) => ({ user_id, client_id, version, state, encrypted_key, encrypted_key_signature }) =>

View File

@@ -53,9 +53,7 @@ export const up = async (db: Kysely<any>) => {
export const down = async (db: Kysely<any>) => { export const down = async (db: Kysely<any>) => {
await db await db
.deleteFrom("file_log") .deleteFrom("file_log")
.where((eb) => .where("action", "in", ["add-to-category", "remove-from-category"])
eb.or([eb("action", "=", "add-to-category"), eb("action", "=", "remove-from-category")]),
)
.execute(); .execute();
await db.schema.dropTable("file_category").execute(); await db.schema.dropTable("file_category").execute();

View File

@@ -62,6 +62,8 @@ export const up = async (db: Kysely<any>) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export const down = async (db: Kysely<any>) => { export const down = async (db: Kysely<any>) => {
await db.deleteFrom("file_log").where("action", "=", "migrate").execute();
await db.schema.dropTable("upload_session").execute(); await db.schema.dropTable("upload_session").execute();
await db.schema await db.schema
.alterTable("thumbnail") .alterTable("thumbnail")