From 309290f9638bcafec82d31c8dc541b19b47b74c7 Mon Sep 17 00:00:00 2001 From: Takumi Akimoto Date: Sat, 2 May 2026 03:04:49 +0900 Subject: [PATCH] fix: Add migration to list --- database/migrations/001_initial.ts | 6 ++++-- database/migrations/002_refresh_token.ts | 4 +++- database/migrator.ts | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/database/migrations/001_initial.ts b/database/migrations/001_initial.ts index d4c807b..18f989c 100644 --- a/database/migrations/001_initial.ts +++ b/database/migrations/001_initial.ts @@ -1,6 +1,6 @@ import type { Kysely } from "@kysely/kysely" -export const up = async (db: Kysely) => { +const up = async (db: Kysely) => { await db.schema .createTable("users") .addColumn("id", "uuid", (col) => col.primaryKey()) @@ -52,10 +52,12 @@ export const up = async (db: Kysely) => { .execute() } -export const down = async (db: Kysely) => { +const down = async (db: Kysely) => { await db.schema.dropTable("user_tokens").execute() await db.schema.dropTable("user_settings").execute() await db.schema.dropTable("system_states").execute() await db.schema.dropTable("posts").execute() await db.schema.dropTable("users").execute() } + +export default { up, down } diff --git a/database/migrations/002_refresh_token.ts b/database/migrations/002_refresh_token.ts index c600ec9..a60c8d0 100644 --- a/database/migrations/002_refresh_token.ts +++ b/database/migrations/002_refresh_token.ts @@ -1,8 +1,10 @@ import { Kysely } from "@kysely/kysely" -export const up = async (db: Kysely) => { +const up = async (db: Kysely) => { await db.schema .alterTable("user_tokens") .dropColumn("refresh_token") .execute() } + +export default { up } diff --git a/database/migrator.ts b/database/migrator.ts index 1ae4883..08ca815 100644 --- a/database/migrator.ts +++ b/database/migrator.ts @@ -1,8 +1,10 @@ import { type Migration, type MigrationProvider } from "@kysely/kysely" -import { down, up } from "./migrations/001_initial.ts" +import migration1 from "./migrations/001_initial.ts" +import migration2 from "./migrations/002_refresh_token.ts" const migrations = { - "001_initial": { up, down }, + "001_initial": migration1, + "002_refresh_token": migration2, } satisfies Record export const migrationProvider = { -- 2.51.2