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:
@@ -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
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user