chore: better typing
This commit is contained in:
@@ -2,10 +2,15 @@ import type { Create } from 'payload/database'
|
||||
|
||||
import toSnakeCase from 'to-snake-case'
|
||||
|
||||
import type { PostgresAdapter } from './types'
|
||||
|
||||
import { upsertRow } from './upsertRow'
|
||||
|
||||
export const create: Create = async function create({ collection: collectionSlug, data, req }) {
|
||||
const db = this.sessions[req.transactionID]?.db || this.db
|
||||
export const create: Create = async function create(
|
||||
this: PostgresAdapter,
|
||||
{ collection: collectionSlug, data, req },
|
||||
) {
|
||||
const db = this.sessions[req.transactionID]?.db || this.drizzle
|
||||
const collection = this.payload.collections[collectionSlug].config
|
||||
|
||||
const result = await upsertRow({
|
||||
|
||||
@@ -78,7 +78,7 @@ export const createMigration: CreateMigration = async function createMigration(
|
||||
|
||||
let drizzleJsonBefore = getDefaultDrizzleSnapshot()
|
||||
|
||||
const hasMigrationTable = await migrationTableExists(this.db)
|
||||
const hasMigrationTable = await migrationTableExists(this.drizzle)
|
||||
|
||||
if (hasMigrationTable) {
|
||||
const migrationQuery = await payload.find({
|
||||
|
||||
Reference in New Issue
Block a user