chore: better typing

This commit is contained in:
Elliot DeNolf
2023-10-02 17:05:26 -04:00
parent 85bcf150a7
commit 7abb2450ef
2 changed files with 8 additions and 3 deletions

View File

@@ -2,10 +2,15 @@ import type { Create } from 'payload/database'
import toSnakeCase from 'to-snake-case' import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import { upsertRow } from './upsertRow' import { upsertRow } from './upsertRow'
export const create: Create = async function create({ collection: collectionSlug, data, req }) { export const create: Create = async function create(
const db = this.sessions[req.transactionID]?.db || this.db this: PostgresAdapter,
{ collection: collectionSlug, data, req },
) {
const db = this.sessions[req.transactionID]?.db || this.drizzle
const collection = this.payload.collections[collectionSlug].config const collection = this.payload.collections[collectionSlug].config
const result = await upsertRow({ const result = await upsertRow({

View File

@@ -78,7 +78,7 @@ export const createMigration: CreateMigration = async function createMigration(
let drizzleJsonBefore = getDefaultDrizzleSnapshot() let drizzleJsonBefore = getDefaultDrizzleSnapshot()
const hasMigrationTable = await migrationTableExists(this.db) const hasMigrationTable = await migrationTableExists(this.drizzle)
if (hasMigrationTable) { if (hasMigrationTable) {
const migrationQuery = await payload.find({ const migrationQuery = await payload.find({