chore: passing pg

This commit is contained in:
James
2024-04-03 10:39:38 -04:00
parent 25d475e165
commit f6bc3eb014
7 changed files with 17 additions and 37 deletions

View File

@@ -125,7 +125,7 @@ jobs:
matrix: matrix:
database: database:
- mongodb - mongodb
# - postgres - postgres
# - postgres-custom-schema # - postgres-custom-schema
# - postgres-uuid # - postgres-uuid
# - supabase # - supabase

7
.vscode/launch.json vendored
View File

@@ -41,11 +41,14 @@
"type": "node-terminal" "type": "node-terminal"
}, },
{ {
"command": "pnpm run dev:postgres versions", "command": "node --no-deprecation test/dev.js versions",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"name": "Run Dev Postgres", "name": "Run Dev Postgres",
"request": "launch", "request": "launch",
"type": "node-terminal" "type": "node-terminal",
"env": {
"PAYLOAD_DATABASE": "postgres"
}
}, },
{ {
"command": "pnpm run dev versions", "command": "pnpm run dev versions",

View File

@@ -66,7 +66,7 @@
"test:e2e": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 tsx ./test/runE2E.ts", "test:e2e": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 tsx ./test/runE2E.ts",
"test:e2e:debug": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PWDEBUG=1 DISABLE_LOGGING=true playwright test", "test:e2e:debug": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PWDEBUG=1 DISABLE_LOGGING=true playwright test",
"test:e2e:headed": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true playwright test --headed", "test:e2e:headed": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true playwright test --headed",
"test:int:postgres": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PAYLOAD_DATABASE=postgres DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=jest.config.js --runInBand", "test:int:postgres": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PAYLOAD_DATABASE=postgres DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=test/jest.config.js --runInBand",
"test:int": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=test/jest.config.js --runInBand", "test:int": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=test/jest.config.js --runInBand",
"test:unit": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=jest.config.js --runInBand", "test:unit": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=jest.config.js --runInBand",
"translateNewKeys": "pnpm --filter payload run translateNewKeys" "translateNewKeys": "pnpm --filter payload run translateNewKeys"

View File

@@ -18,9 +18,11 @@ export const baseIDField: Field = {
// If creating new doc, need to disregard any // If creating new doc, need to disregard any
// ids that have been passed in because they will cause // ids that have been passed in because they will cause
// primary key unique conflicts in relational DBs // primary key unique conflicts in relational DBs
if (value && operation === 'create') { if (!value || (operation === 'create' && value)) {
return new ObjectId().toHexString() return new ObjectId().toHexString()
} }
return value
}, },
], ],
}, },

View File

@@ -1,7 +1,7 @@
import type { CollectionConfig } from 'payload/types' import type { CollectionConfig } from 'payload/types'
import type { BlockField } from 'payload/types' import type { BlockField } from 'payload/types'
import { lexicalEditor } from '@payloadcms/richtext-lexical' import { slateEditor } from '@payloadcms/richtext-slate'
import { blockFieldsSlug, textFieldsSlug } from '../../slugs.js' import { blockFieldsSlug, textFieldsSlug } from '../../slugs.js'
import { AddCustomBlocks } from './components/AddCustomBlocks/index.js' import { AddCustomBlocks } from './components/AddCustomBlocks/index.js'
@@ -22,7 +22,7 @@ export const getBlocksField = (prefix?: string): BlockField => ({
{ {
name: 'richText', name: 'richText',
type: 'richText', type: 'richText',
editor: lexicalEditor({}), editor: slateEditor({}),
}, },
], ],
}, },

View File

@@ -5,36 +5,11 @@ export const getBlocksFieldSeedData = (prefix?: string): any => [
blockName: 'First block', blockName: 'First block',
blockType: prefix ? `${prefix}Content` : 'content', blockType: prefix ? `${prefix}Content` : 'content',
text: 'first block', text: 'first block',
richText: { richText: [
root: { {
type: 'root', children: [{ text: '' }],
format: '',
indent: 0,
version: 1,
children: [
{
children: [
{
detail: 0,
format: 0,
mode: 'normal',
style: '',
text: '',
type: 'text',
version: 1,
},
],
direction: 'ltr',
format: '',
indent: 0,
type: 'paragraph',
version: 1,
},
],
direction: 'ltr',
}, },
}, ],
}, },
{ {
blockName: 'Second block', blockName: 'Second block',

View File

@@ -1,6 +1,6 @@
import type { CollectionConfig } from 'payload/types' import type { CollectionConfig } from 'payload/types'
export const nestedToArrayAndBlockCollectionSlug = 'nested-to-array-and-block' export const nestedToArrayAndBlockCollectionSlug = 'nested'
export const NestedToArrayAndBlock: CollectionConfig = { export const NestedToArrayAndBlock: CollectionConfig = {
slug: nestedToArrayAndBlockCollectionSlug, slug: nestedToArrayAndBlockCollectionSlug,