mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 16:16:55 +00:00
즐겨찾기 기능 구현
This commit is contained in:
29
src/lib/server/db/migrations/1768643000-AddFavorites.ts
Normal file
29
src/lib/server/db/migrations/1768643000-AddFavorites.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Kysely, sql } from "kysely";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const up = async (db: Kysely<any>) => {
|
||||
// file.ts
|
||||
await db.schema
|
||||
.alterTable("directory")
|
||||
.addColumn("is_favorite", "boolean", (col) => col.notNull().defaultTo(false))
|
||||
.execute();
|
||||
await db.schema
|
||||
.alterTable("file")
|
||||
.addColumn("is_favorite", "boolean", (col) => col.notNull().defaultTo(false))
|
||||
.execute();
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const down = async (db: Kysely<any>) => {
|
||||
await db
|
||||
.deleteFrom("file_log")
|
||||
.where("action", "in", ["add-to-favorites", "remove-from-favorites"])
|
||||
.execute();
|
||||
await db
|
||||
.deleteFrom("directory_log")
|
||||
.where("action", "in", ["add-to-favorites", "remove-from-favorites"])
|
||||
.execute();
|
||||
|
||||
await db.schema.alterTable("file").dropColumn("is_favorite").execute();
|
||||
await db.schema.alterTable("directory").dropColumn("is_favorite").execute();
|
||||
};
|
||||
Reference in New Issue
Block a user