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