chore: db init & destroy type improvements. No need to pass in payload again, as the functions already have access to it through the adapter

This commit is contained in:
Alessio Gravili
2024-03-13 15:04:16 -04:00
parent 885b003730
commit cf1632f80b
2 changed files with 3 additions and 3 deletions

View File

@@ -129,7 +129,7 @@ export interface BaseDatabaseAdapter {
updateVersion: UpdateVersion updateVersion: UpdateVersion
} }
export type Init = (payload: Payload) => Promise<void> | void export type Init = () => Promise<void> | void
type ConnectArgs = { type ConnectArgs = {
hotReload: boolean hotReload: boolean
@@ -137,7 +137,7 @@ type ConnectArgs = {
export type Connect = (args?: ConnectArgs) => Promise<void> export type Connect = (args?: ConnectArgs) => Promise<void>
export type Destroy = (payload: Payload) => Promise<void> export type Destroy = () => Promise<void>
export type CreateMigration = (args: { export type CreateMigration = (args: {
file?: string file?: string

View File

@@ -330,7 +330,7 @@ export class BasePayload<TGeneratedTypes extends GeneratedTypes> {
this.db.payload = this this.db.payload = this
if (this.db?.init) { if (this.db?.init) {
await this.db.init(this) await this.db.init()
} }
if (!options.disableDBConnect && this.db.connect) { if (!options.disableDBConnect && this.db.connect) {