This commit is contained in:
fullex 2025-07-28 22:40:19 +08:00
parent aa47fc3ed7
commit c0efb46c2b
2 changed files with 6 additions and 4 deletions

View File

@ -1,13 +1,15 @@
import { loggerService } from '@logger'
import { drizzle } from 'drizzle-orm/libsql' import { drizzle } from 'drizzle-orm/libsql'
import { migrate } from 'drizzle-orm/libsql/migrator' import { migrate } from 'drizzle-orm/libsql/migrator'
import { app } from 'electron' import { app } from 'electron'
import Logger from 'electron-log'
import path from 'path' import path from 'path'
import { pathToFileURL } from 'url' import { pathToFileURL } from 'url'
import Seeding from './seeding' import Seeding from './seeding'
import type { DbType } from './types' import type { DbType } from './types'
const logger = loggerService.withContext('DbService')
const DB_NAME = 'cherrystudio.sqlite' const DB_NAME = 'cherrystudio.sqlite'
const MIGRATIONS_BASE_PATH = 'migrations/sqlite-drizzle' const MIGRATIONS_BASE_PATH = 'migrations/sqlite-drizzle'
@ -44,7 +46,7 @@ class DbService {
await new Seed().migrate(this.db) await new Seed().migrate(this.db)
return true return true
} catch (error) { } catch (error) {
Logger.error(error) logger.error('migration seeding failed', error as Error)
return false return false
} }
} }

View File

@ -1,2 +1,2 @@
* All the database table names use **singular** form, snake_casing - All the database table names use **singular** form, snake_casing
* Export table names use `xxxxTable` - Export table names use `xxxxTable`