@payloadcms/db-postgres 3.0.0-canary.f6e77b8 → 3.0.0-canary.fb81f02
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/connect.d.ts +1 -1
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +17 -51
- package/dist/connect.js.map +1 -1
- package/dist/connectionHelpers/nodePostgres.d.ts +11 -0
- package/dist/connectionHelpers/nodePostgres.d.ts.map +1 -0
- package/dist/connectionHelpers/nodePostgres.js +6 -0
- package/dist/connectionHelpers/nodePostgres.js.map +1 -0
- package/dist/countDistinct.d.ts +3 -0
- package/dist/countDistinct.d.ts.map +1 -0
- package/dist/countDistinct.js +24 -0
- package/dist/countDistinct.js.map +1 -0
- package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
- package/dist/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
- package/dist/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
- package/dist/createJSONQuery/formatJSONPathSegment.js.map +1 -0
- package/dist/createJSONQuery/index.d.ts.map +1 -0
- package/dist/createJSONQuery/index.js.map +1 -0
- package/dist/createMigration.d.ts +1 -1
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js +67 -57
- package/dist/createMigration.js.map +1 -1
- package/dist/defaultSnapshot.d.ts +3 -0
- package/dist/defaultSnapshot.d.ts.map +1 -0
- package/dist/defaultSnapshot.js +17 -0
- package/dist/defaultSnapshot.js.map +1 -0
- package/dist/deleteWhere.d.ts +3 -0
- package/dist/deleteWhere.d.ts.map +1 -0
- package/dist/deleteWhere.js +6 -0
- package/dist/deleteWhere.js.map +1 -0
- package/dist/dropDatabase.d.ts +3 -0
- package/dist/dropDatabase.d.ts.map +1 -0
- package/dist/dropDatabase.js +9 -0
- package/dist/dropDatabase.js.map +1 -0
- package/dist/execute.d.ts +3 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +11 -0
- package/dist/execute.js.map +1 -0
- package/dist/exports/migration-utils.d.ts +2 -0
- package/dist/exports/migration-utils.d.ts.map +1 -0
- package/dist/exports/migration-utils.js +3 -0
- package/dist/exports/migration-utils.js.map +1 -0
- package/dist/getMigrationTemplate.d.ts +4 -0
- package/dist/getMigrationTemplate.d.ts.map +1 -0
- package/dist/getMigrationTemplate.js +13 -0
- package/dist/getMigrationTemplate.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -66
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +17 -30
- package/dist/init.js.map +1 -1
- package/dist/insert.d.ts +3 -0
- package/dist/insert.d.ts.map +1 -0
- package/dist/insert.js +12 -0
- package/dist/insert.js.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
- package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
- package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +191 -0
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
- package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/index.js +211 -0
- package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +57 -0
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
- package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
- package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
- package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
- package/dist/predefinedMigrations/v2-v3/types.js +6 -0
- package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
- package/dist/requireDrizzleKit.d.ts +3 -0
- package/dist/requireDrizzleKit.d.ts.map +1 -0
- package/dist/requireDrizzleKit.js +5 -0
- package/dist/requireDrizzleKit.js.map +1 -0
- package/dist/schema/build.d.ts +9 -5
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +163 -114
- package/dist/schema/build.js.map +1 -1
- package/dist/schema/createIndex.d.ts.map +1 -1
- package/dist/schema/createIndex.js +1 -1
- package/dist/schema/createIndex.js.map +1 -1
- package/dist/schema/idToUUID.d.ts +1 -1
- package/dist/schema/idToUUID.d.ts.map +1 -1
- package/dist/schema/idToUUID.js.map +1 -1
- package/dist/schema/parentIDColumnMap.js.map +1 -1
- package/dist/schema/setColumnID.d.ts +1 -1
- package/dist/schema/setColumnID.d.ts.map +1 -1
- package/dist/schema/setColumnID.js +2 -2
- package/dist/schema/setColumnID.js.map +1 -1
- package/dist/schema/traverseFields.d.ts +5 -7
- package/dist/schema/traverseFields.d.ts.map +1 -1
- package/dist/schema/traverseFields.js +118 -56
- package/dist/schema/traverseFields.js.map +1 -1
- package/dist/schema/withDefault.d.ts +4 -0
- package/dist/schema/withDefault.d.ts.map +1 -0
- package/dist/schema/withDefault.js +10 -0
- package/dist/schema/withDefault.js.map +1 -0
- package/dist/types.d.ts +111 -39
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +25 -15
- package/dist/count.d.ts +0 -3
- package/dist/count.d.ts.map +0 -1
- package/dist/count.js +0 -50
- package/dist/count.js.map +0 -1
- package/dist/create.d.ts +0 -3
- package/dist/create.d.ts.map +0 -1
- package/dist/create.js +0 -19
- package/dist/create.js.map +0 -1
- package/dist/createGlobal.d.ts +0 -5
- package/dist/createGlobal.d.ts.map +0 -1
- package/dist/createGlobal.js +0 -19
- package/dist/createGlobal.js.map +0 -1
- package/dist/createGlobalVersion.d.ts +0 -6
- package/dist/createGlobalVersion.d.ts.map +0 -1
- package/dist/createGlobalVersion.js +0 -33
- package/dist/createGlobalVersion.js.map +0 -1
- package/dist/createVersion.d.ts +0 -5
- package/dist/createVersion.d.ts.map +0 -1
- package/dist/createVersion.js +0 -44
- package/dist/createVersion.js.map +0 -1
- package/dist/deleteMany.d.ts +0 -3
- package/dist/deleteMany.d.ts.map +0 -1
- package/dist/deleteMany.js +0 -28
- package/dist/deleteMany.js.map +0 -1
- package/dist/deleteOne.d.ts +0 -3
- package/dist/deleteOne.d.ts.map +0 -1
- package/dist/deleteOne.js +0 -59
- package/dist/deleteOne.js.map +0 -1
- package/dist/deleteVersions.d.ts +0 -3
- package/dist/deleteVersions.d.ts.map +0 -1
- package/dist/deleteVersions.js +0 -31
- package/dist/deleteVersions.js.map +0 -1
- package/dist/destroy.d.ts +0 -3
- package/dist/destroy.d.ts.map +0 -1
- package/dist/destroy.js +0 -11
- package/dist/destroy.js.map +0 -1
- package/dist/find/buildFindManyArgs.d.ts +0 -13
- package/dist/find/buildFindManyArgs.d.ts.map +0 -1
- package/dist/find/buildFindManyArgs.js +0 -64
- package/dist/find/buildFindManyArgs.js.map +0 -1
- package/dist/find/chainMethods.d.ts +0 -16
- package/dist/find/chainMethods.d.ts.map +0 -1
- package/dist/find/chainMethods.js +0 -12
- package/dist/find/chainMethods.js.map +0 -1
- package/dist/find/findMany.d.ts +0 -22
- package/dist/find/findMany.d.ts.map +0 -1
- package/dist/find/findMany.js +0 -163
- package/dist/find/findMany.js.map +0 -1
- package/dist/find/traverseFields.d.ts +0 -16
- package/dist/find/traverseFields.d.ts.map +0 -1
- package/dist/find/traverseFields.js +0 -138
- package/dist/find/traverseFields.js.map +0 -1
- package/dist/find.d.ts +0 -3
- package/dist/find.d.ts.map +0 -1
- package/dist/find.js +0 -21
- package/dist/find.js.map +0 -1
- package/dist/findGlobal.d.ts +0 -3
- package/dist/findGlobal.d.ts.map +0 -1
- package/dist/findGlobal.js +0 -23
- package/dist/findGlobal.js.map +0 -1
- package/dist/findGlobalVersions.d.ts +0 -3
- package/dist/findGlobalVersions.d.ts.map +0 -1
- package/dist/findGlobalVersions.js +0 -24
- package/dist/findGlobalVersions.js.map +0 -1
- package/dist/findOne.d.ts +0 -5
- package/dist/findOne.d.ts.map +0 -1
- package/dist/findOne.js +0 -21
- package/dist/findOne.js.map +0 -1
- package/dist/findVersions.d.ts +0 -3
- package/dist/findVersions.d.ts.map +0 -1
- package/dist/findVersions.js +0 -24
- package/dist/findVersions.js.map +0 -1
- package/dist/migrate.d.ts +0 -3
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -99
- package/dist/migrate.js.map +0 -1
- package/dist/migrateDown.d.ts +0 -3
- package/dist/migrateDown.d.ts.map +0 -1
- package/dist/migrateDown.js +0 -63
- package/dist/migrateDown.js.map +0 -1
- package/dist/migrateFresh.d.ts +0 -8
- package/dist/migrateFresh.d.ts.map +0 -1
- package/dist/migrateFresh.js +0 -72
- package/dist/migrateFresh.js.map +0 -1
- package/dist/migrateRefresh.d.ts +0 -6
- package/dist/migrateRefresh.d.ts.map +0 -1
- package/dist/migrateRefresh.js +0 -102
- package/dist/migrateRefresh.js.map +0 -1
- package/dist/migrateReset.d.ts +0 -6
- package/dist/migrateReset.d.ts.map +0 -1
- package/dist/migrateReset.js +0 -82
- package/dist/migrateReset.js.map +0 -1
- package/dist/migrateStatus.d.ts +0 -3
- package/dist/migrateStatus.d.ts.map +0 -1
- package/dist/migrateStatus.js +0 -44
- package/dist/migrateStatus.js.map +0 -1
- package/dist/queries/buildAndOrConditions.d.ts +0 -17
- package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
- package/dist/queries/buildAndOrConditions.js +0 -29
- package/dist/queries/buildAndOrConditions.js.map +0 -1
- package/dist/queries/buildQuery.d.ts +0 -31
- package/dist/queries/buildQuery.d.ts.map +0 -1
- package/dist/queries/buildQuery.js +0 -76
- package/dist/queries/buildQuery.js.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
- package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
- package/dist/queries/createJSONQuery/index.js.map +0 -1
- package/dist/queries/getTableColumnFromPath.d.ts +0 -51
- package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
- package/dist/queries/getTableColumnFromPath.js +0 -445
- package/dist/queries/getTableColumnFromPath.js.map +0 -1
- package/dist/queries/operatorMap.d.ts +0 -18
- package/dist/queries/operatorMap.d.ts.map +0 -1
- package/dist/queries/operatorMap.js +0 -24
- package/dist/queries/operatorMap.js.map +0 -1
- package/dist/queries/parseParams.d.ts +0 -17
- package/dist/queries/parseParams.d.ts.map +0 -1
- package/dist/queries/parseParams.js +0 -182
- package/dist/queries/parseParams.js.map +0 -1
- package/dist/queries/sanitizeQueryValue.d.ts +0 -15
- package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
- package/dist/queries/sanitizeQueryValue.js +0 -90
- package/dist/queries/sanitizeQueryValue.js.map +0 -1
- package/dist/queries/selectDistinct.d.ts +0 -23
- package/dist/queries/selectDistinct.d.ts.map +0 -1
- package/dist/queries/selectDistinct.js +0 -41
- package/dist/queries/selectDistinct.js.map +0 -1
- package/dist/queryDrafts.d.ts +0 -3
- package/dist/queryDrafts.d.ts.map +0 -1
- package/dist/queryDrafts.js +0 -41
- package/dist/queryDrafts.js.map +0 -1
- package/dist/schema/createTableName.d.ts +0 -30
- package/dist/schema/createTableName.d.ts.map +0 -1
- package/dist/schema/createTableName.js +0 -31
- package/dist/schema/createTableName.js.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
- package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
- package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
- package/dist/transactions/beginTransaction.d.ts +0 -3
- package/dist/transactions/beginTransaction.d.ts.map +0 -1
- package/dist/transactions/beginTransaction.js +0 -47
- package/dist/transactions/beginTransaction.js.map +0 -1
- package/dist/transactions/commitTransaction.d.ts +0 -3
- package/dist/transactions/commitTransaction.d.ts.map +0 -1
- package/dist/transactions/commitTransaction.js +0 -14
- package/dist/transactions/commitTransaction.js.map +0 -1
- package/dist/transactions/rollbackTransaction.d.ts +0 -3
- package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
- package/dist/transactions/rollbackTransaction.js +0 -13
- package/dist/transactions/rollbackTransaction.js.map +0 -1
- package/dist/transform/read/hasManyNumber.d.ts +0 -10
- package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
- package/dist/transform/read/hasManyNumber.js +0 -10
- package/dist/transform/read/hasManyNumber.js.map +0 -1
- package/dist/transform/read/hasManyText.d.ts +0 -10
- package/dist/transform/read/hasManyText.d.ts.map +0 -1
- package/dist/transform/read/hasManyText.js +0 -10
- package/dist/transform/read/hasManyText.js.map +0 -1
- package/dist/transform/read/index.d.ts +0 -12
- package/dist/transform/read/index.d.ts.map +0 -1
- package/dist/transform/read/index.js +0 -43
- package/dist/transform/read/index.js.map +0 -1
- package/dist/transform/read/relationship.d.ts +0 -10
- package/dist/transform/read/relationship.d.ts.map +0 -1
- package/dist/transform/read/relationship.js +0 -64
- package/dist/transform/read/relationship.js.map +0 -1
- package/dist/transform/read/traverseFields.d.ts +0 -52
- package/dist/transform/read/traverseFields.d.ts.map +0 -1
- package/dist/transform/read/traverseFields.js +0 -421
- package/dist/transform/read/traverseFields.js.map +0 -1
- package/dist/transform/write/array.d.ts +0 -26
- package/dist/transform/write/array.d.ts.map +0 -1
- package/dist/transform/write/array.js +0 -58
- package/dist/transform/write/array.js.map +0 -1
- package/dist/transform/write/blocks.d.ts +0 -25
- package/dist/transform/write/blocks.d.ts.map +0 -1
- package/dist/transform/write/blocks.js +0 -54
- package/dist/transform/write/blocks.js.map +0 -1
- package/dist/transform/write/index.d.ts +0 -13
- package/dist/transform/write/index.d.ts.map +0 -1
- package/dist/transform/write/index.js +0 -41
- package/dist/transform/write/index.js.map +0 -1
- package/dist/transform/write/numbers.d.ts +0 -8
- package/dist/transform/write/numbers.d.ts.map +0 -1
- package/dist/transform/write/numbers.js +0 -11
- package/dist/transform/write/numbers.js.map +0 -1
- package/dist/transform/write/relationships.d.ts +0 -10
- package/dist/transform/write/relationships.d.ts.map +0 -1
- package/dist/transform/write/relationships.js +0 -23
- package/dist/transform/write/relationships.js.map +0 -1
- package/dist/transform/write/selects.d.ts +0 -8
- package/dist/transform/write/selects.d.ts.map +0 -1
- package/dist/transform/write/selects.js +0 -20
- package/dist/transform/write/selects.js.map +0 -1
- package/dist/transform/write/texts.d.ts +0 -8
- package/dist/transform/write/texts.d.ts.map +0 -1
- package/dist/transform/write/texts.js +0 -11
- package/dist/transform/write/texts.js.map +0 -1
- package/dist/transform/write/traverseFields.d.ts +0 -50
- package/dist/transform/write/traverseFields.d.ts.map +0 -1
- package/dist/transform/write/traverseFields.js +0 -428
- package/dist/transform/write/traverseFields.js.map +0 -1
- package/dist/transform/write/types.d.ts +0 -43
- package/dist/transform/write/types.d.ts.map +0 -1
- package/dist/transform/write/types.js +0 -3
- package/dist/transform/write/types.js.map +0 -1
- package/dist/update.d.ts +0 -3
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -55
- package/dist/update.js.map +0 -1
- package/dist/updateGlobal.d.ts +0 -5
- package/dist/updateGlobal.d.ts.map +0 -1
- package/dist/updateGlobal.js +0 -25
- package/dist/updateGlobal.js.map +0 -1
- package/dist/updateGlobalVersion.d.ts +0 -5
- package/dist/updateGlobalVersion.d.ts.map +0 -1
- package/dist/updateGlobalVersion.js +0 -36
- package/dist/updateGlobalVersion.js.map +0 -1
- package/dist/updateVersion.d.ts +0 -5
- package/dist/updateVersion.d.ts.map +0 -1
- package/dist/updateVersion.js +0 -36
- package/dist/updateVersion.js.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
- package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
- package/dist/upsertRow/index.d.ts +0 -4
- package/dist/upsertRow/index.d.ts.map +0 -1
- package/dist/upsertRow/index.js +0 -277
- package/dist/upsertRow/index.js.map +0 -1
- package/dist/upsertRow/insertArrays.d.ts +0 -13
- package/dist/upsertRow/insertArrays.d.ts.map +0 -1
- package/dist/upsertRow/insertArrays.js +0 -68
- package/dist/upsertRow/insertArrays.js.map +0 -1
- package/dist/upsertRow/types.d.ts +0 -27
- package/dist/upsertRow/types.d.ts.map +0 -1
- package/dist/upsertRow/types.js +0 -3
- package/dist/upsertRow/types.js.map +0 -1
- package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
- package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
- package/dist/utilities/appendPrefixToKeys.js +0 -6
- package/dist/utilities/appendPrefixToKeys.js.map +0 -1
- package/dist/utilities/createBlocksMap.d.ts +0 -5
- package/dist/utilities/createBlocksMap.d.ts.map +0 -1
- package/dist/utilities/createBlocksMap.js +0 -29
- package/dist/utilities/createBlocksMap.js.map +0 -1
- package/dist/utilities/createMigrationTable.d.ts +0 -3
- package/dist/utilities/createMigrationTable.d.ts.map +0 -1
- package/dist/utilities/createMigrationTable.js +0 -13
- package/dist/utilities/createMigrationTable.js.map +0 -1
- package/dist/utilities/createRelationshipMap.d.ts +0 -2
- package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
- package/dist/utilities/createRelationshipMap.js +0 -19
- package/dist/utilities/createRelationshipMap.js.map +0 -1
- package/dist/utilities/hasLocalesTable.d.ts +0 -3
- package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
- package/dist/utilities/hasLocalesTable.js +0 -11
- package/dist/utilities/hasLocalesTable.js.map +0 -1
- package/dist/utilities/isArrayOfRows.d.ts +0 -2
- package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
- package/dist/utilities/isArrayOfRows.js +0 -5
- package/dist/utilities/isArrayOfRows.js.map +0 -1
- package/dist/utilities/migrationTableExists.d.ts +0 -3
- package/dist/utilities/migrationTableExists.d.ts.map +0 -1
- package/dist/utilities/migrationTableExists.js +0 -9
- package/dist/utilities/migrationTableExists.js.map +0 -1
- package/dist/utilities/parseError.d.ts +0 -5
- package/dist/utilities/parseError.d.ts.map +0 -1
- package/dist/utilities/parseError.js +0 -17
- package/dist/utilities/parseError.js.map +0 -1
- package/dist/utilities/pushDevSchema.d.ts +0 -9
- package/dist/utilities/pushDevSchema.d.ts.map +0 -1
- package/dist/utilities/pushDevSchema.js +0 -58
- package/dist/utilities/pushDevSchema.js.map +0 -1
- /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.d.ts +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.js +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.d.ts +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.js +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/index.d.ts +0 -0
- /package/dist/{queries/createJSONQuery → createJSONQuery}/index.js +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/getMigrationTemplate.ts"],"sourcesContent":["import type { MigrationTemplateArgs } from 'payload'\n\nexport const indent = (text: string) =>\n text\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')\n\nexport const getMigrationTemplate = ({\n downSQL,\n imports,\n upSQL,\n}: MigrationTemplateArgs): string => `import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'\n${imports ? `${imports}\\n` : ''}\nexport async function up({ payload, req }: MigrateUpArgs): Promise<void> {\n${indent(upSQL)}\n}\n\nexport async function down({ payload, req }: MigrateDownArgs): Promise<void> {\n${indent(downSQL)}\n}\n`\n"],"names":["indent","text","split","map","line","join","getMigrationTemplate","downSQL","imports","upSQL"],"mappings":"AAEA,OAAO,MAAMA,SAAS,CAACC,OACrBA,KACGC,KAAK,CAAC,MACNC,GAAG,CAAC,CAACC,OAAS,CAAC,EAAE,EAAEA,KAAK,CAAC,EACzBC,IAAI,CAAC,MAAK;AAEf,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,OAAO,EACPC,OAAO,EACPC,KAAK,EACiB,GAAa,CAAC;AACtC,EAAED,UAAU,CAAC,EAAEA,QAAQ,EAAE,CAAC,GAAG,GAAG;;AAEhC,EAAER,OAAOS,OAAO;;;;AAIhB,EAAET,OAAOO,SAAS;;AAElB,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import type { DatabaseAdapterObj } from 'payload
|
1
|
+
import type { DatabaseAdapterObj } from 'payload';
|
2
|
+
export { nodePostgres } from './connectionHelpers/nodePostgres.js';
|
2
3
|
import type { Args, PostgresAdapter } from './types.js';
|
3
4
|
export type { MigrateDownArgs, MigrateUpArgs } from './types.js';
|
4
5
|
export { sql } from 'drizzle-orm';
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAqClE,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAgBvD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAuG/E"}
|
package/dist/index.js
CHANGED
@@ -1,54 +1,60 @@
|
|
1
|
-
|
2
|
-
import
|
3
|
-
import {
|
1
|
+
export { nodePostgres } from './connectionHelpers/nodePostgres.js';
|
2
|
+
import { beginTransaction, commitTransaction, count, create, createGlobal, createGlobalVersion, createVersion, deleteMany, deleteOne, deleteVersions, destroy, find, findGlobal, findGlobalVersions, findMigrationDir, findOne, findVersions, migrate, migrateDown, migrateFresh, migrateRefresh, migrateReset, migrateStatus, operatorMap, queryDrafts, rollbackTransaction, updateGlobal, updateGlobalVersion, updateOne, updateVersion } from '@payloadcms/drizzle';
|
3
|
+
import { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core';
|
4
|
+
import { createDatabaseAdapter } from 'payload';
|
4
5
|
import { connect } from './connect.js';
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import { createGlobalVersion } from './createGlobalVersion.js';
|
6
|
+
import { countDistinct } from './countDistinct.js';
|
7
|
+
import { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js';
|
8
|
+
import { createJSONQuery } from './createJSONQuery/index.js';
|
9
9
|
import { createMigration } from './createMigration.js';
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import { find } from './find.js';
|
16
|
-
import { findGlobal } from './findGlobal.js';
|
17
|
-
import { findGlobalVersions } from './findGlobalVersions.js';
|
18
|
-
import { findOne } from './findOne.js';
|
19
|
-
import { findVersions } from './findVersions.js';
|
10
|
+
import { defaultDrizzleSnapshot } from './defaultSnapshot.js';
|
11
|
+
import { deleteWhere } from './deleteWhere.js';
|
12
|
+
import { dropDatabase } from './dropDatabase.js';
|
13
|
+
import { execute } from './execute.js';
|
14
|
+
import { getMigrationTemplate } from './getMigrationTemplate.js';
|
20
15
|
import { init } from './init.js';
|
21
|
-
import {
|
22
|
-
import {
|
23
|
-
import { migrateFresh } from './migrateFresh.js';
|
24
|
-
import { migrateRefresh } from './migrateRefresh.js';
|
25
|
-
import { migrateReset } from './migrateReset.js';
|
26
|
-
import { migrateStatus } from './migrateStatus.js';
|
27
|
-
import { queryDrafts } from './queryDrafts.js';
|
28
|
-
import { beginTransaction } from './transactions/beginTransaction.js';
|
29
|
-
import { commitTransaction } from './transactions/commitTransaction.js';
|
30
|
-
import { rollbackTransaction } from './transactions/rollbackTransaction.js';
|
31
|
-
import { updateOne } from './update.js';
|
32
|
-
import { updateGlobal } from './updateGlobal.js';
|
33
|
-
import { updateGlobalVersion } from './updateGlobalVersion.js';
|
34
|
-
import { updateVersion } from './updateVersion.js';
|
16
|
+
import { insert } from './insert.js';
|
17
|
+
import { requireDrizzleKit } from './requireDrizzleKit.js';
|
35
18
|
export { sql } from 'drizzle-orm';
|
36
19
|
export function postgresAdapter(args) {
|
37
20
|
const postgresIDType = args.idType || 'serial';
|
38
21
|
const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text';
|
39
22
|
function adapter({ payload }) {
|
40
23
|
const migrationDir = findMigrationDir(args.migrationDir);
|
24
|
+
let resolveInitializing;
|
25
|
+
let rejectInitializing;
|
26
|
+
let adapterSchema;
|
27
|
+
const initializing = new Promise((res, rej)=>{
|
28
|
+
resolveInitializing = res;
|
29
|
+
rejectInitializing = rej;
|
30
|
+
});
|
31
|
+
if (args.schemaName) {
|
32
|
+
adapterSchema = pgSchema(args.schemaName);
|
33
|
+
} else {
|
34
|
+
adapterSchema = {
|
35
|
+
enum: pgEnum,
|
36
|
+
table: pgTable
|
37
|
+
};
|
38
|
+
}
|
41
39
|
return createDatabaseAdapter({
|
42
40
|
name: 'postgres',
|
41
|
+
defaultDrizzleSnapshot,
|
43
42
|
drizzle: undefined,
|
44
43
|
enums: {},
|
44
|
+
features: {
|
45
|
+
json: true
|
46
|
+
},
|
45
47
|
fieldConstraints: {},
|
48
|
+
getDrizzle: args.getDrizzle,
|
49
|
+
getMigrationTemplate,
|
46
50
|
idType: postgresIDType,
|
51
|
+
initializing,
|
47
52
|
localesSuffix: args.localesSuffix || '_locales',
|
48
53
|
logger: args.logger,
|
49
|
-
|
54
|
+
operators: operatorMap,
|
55
|
+
pgSchema: adapterSchema,
|
50
56
|
pool: undefined,
|
51
|
-
|
57
|
+
prodMigrations: args.prodMigrations,
|
52
58
|
push: args.push,
|
53
59
|
relations: {},
|
54
60
|
relationshipsSuffix: args.relationshipsSuffix || '_rels',
|
@@ -57,28 +63,36 @@ export function postgresAdapter(args) {
|
|
57
63
|
sessions: {},
|
58
64
|
tableNameMap: new Map(),
|
59
65
|
tables: {},
|
66
|
+
transactionOptions: args.transactionOptions || undefined,
|
60
67
|
versionsSuffix: args.versionsSuffix || '_v',
|
61
68
|
// DatabaseAdapter
|
62
|
-
beginTransaction,
|
69
|
+
beginTransaction: args.transactionOptions === false ? undefined : beginTransaction,
|
63
70
|
commitTransaction,
|
64
71
|
connect,
|
72
|
+
convertPathToJSONTraversal,
|
65
73
|
count,
|
74
|
+
countDistinct,
|
66
75
|
create,
|
67
76
|
createGlobal,
|
68
77
|
createGlobalVersion,
|
78
|
+
createJSONQuery,
|
69
79
|
createMigration,
|
70
80
|
createVersion,
|
71
81
|
defaultIDType: payloadIDType,
|
72
82
|
deleteMany,
|
73
83
|
deleteOne,
|
74
84
|
deleteVersions,
|
85
|
+
deleteWhere,
|
75
86
|
destroy,
|
87
|
+
dropDatabase,
|
88
|
+
execute,
|
76
89
|
find,
|
77
90
|
findGlobal,
|
78
91
|
findGlobalVersions,
|
79
92
|
findOne,
|
80
93
|
findVersions,
|
81
94
|
init,
|
95
|
+
insert,
|
82
96
|
migrate,
|
83
97
|
migrateDown,
|
84
98
|
migrateFresh,
|
@@ -88,6 +102,9 @@ export function postgresAdapter(args) {
|
|
88
102
|
migrationDir,
|
89
103
|
payload,
|
90
104
|
queryDrafts,
|
105
|
+
rejectInitializing,
|
106
|
+
requireDrizzleKit,
|
107
|
+
resolveInitializing,
|
91
108
|
rollbackTransaction,
|
92
109
|
updateGlobal,
|
93
110
|
updateGlobalVersion,
|
@@ -100,37 +117,5 @@ export function postgresAdapter(args) {
|
|
100
117
|
init: adapter
|
101
118
|
};
|
102
119
|
}
|
103
|
-
/**
|
104
|
-
* Attempt to find migrations directory.
|
105
|
-
*
|
106
|
-
* Checks for the following directories in order:
|
107
|
-
* - `migrationDir` argument from Payload config
|
108
|
-
* - `src/migrations`
|
109
|
-
* - `dist/migrations`
|
110
|
-
* - `migrations`
|
111
|
-
*
|
112
|
-
* Defaults to `src/migrations`
|
113
|
-
*
|
114
|
-
* @param migrationDir
|
115
|
-
* @returns
|
116
|
-
*/ function findMigrationDir(migrationDir) {
|
117
|
-
const cwd = process.cwd();
|
118
|
-
const srcDir = path.resolve(cwd, 'src/migrations');
|
119
|
-
const distDir = path.resolve(cwd, 'dist/migrations');
|
120
|
-
const relativeMigrations = path.resolve(cwd, 'migrations');
|
121
|
-
// Use arg if provided
|
122
|
-
if (migrationDir) return migrationDir;
|
123
|
-
// Check other common locations
|
124
|
-
if (fs.existsSync(srcDir)) {
|
125
|
-
return srcDir;
|
126
|
-
}
|
127
|
-
if (fs.existsSync(distDir)) {
|
128
|
-
return distDir;
|
129
|
-
}
|
130
|
-
if (fs.existsSync(relativeMigrations)) {
|
131
|
-
return relativeMigrations;
|
132
|
-
}
|
133
|
-
return srcDir;
|
134
|
-
}
|
135
120
|
|
136
121
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { DatabaseAdapterObj, Payload } from 'payload'\n\nexport { nodePostgres } from './connectionHelpers/nodePostgres.js'\n\nimport {\n beginTransaction,\n commitTransaction,\n count,\n create,\n createGlobal,\n createGlobalVersion,\n createVersion,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findMigrationDir,\n findOne,\n findVersions,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n operatorMap,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n} from '@payloadcms/drizzle'\nimport { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'\nimport { createDatabaseAdapter } from 'payload'\n\nimport type { Args, PostgresAdapter } from './types.js'\n\nimport { connect } from './connect.js'\nimport { countDistinct } from './countDistinct.js'\nimport { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js'\nimport { createJSONQuery } from './createJSONQuery/index.js'\nimport { createMigration } from './createMigration.js'\nimport { defaultDrizzleSnapshot } from './defaultSnapshot.js'\nimport { deleteWhere } from './deleteWhere.js'\nimport { dropDatabase } from './dropDatabase.js'\nimport { execute } from './execute.js'\nimport { getMigrationTemplate } from './getMigrationTemplate.js'\nimport { init } from './init.js'\nimport { insert } from './insert.js'\nimport { requireDrizzleKit } from './requireDrizzleKit.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport { sql } from 'drizzle-orm'\n\nexport function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n let resolveInitializing\n let rejectInitializing\n let adapterSchema: PostgresAdapter['pgSchema']\n\n const initializing = new Promise<void>((res, rej) => {\n resolveInitializing = res\n rejectInitializing = rej\n })\n\n if (args.schemaName) {\n adapterSchema = pgSchema(args.schemaName)\n } else {\n adapterSchema = { enum: pgEnum, table: pgTable }\n }\n\n return createDatabaseAdapter<PostgresAdapter>({\n name: 'postgres',\n defaultDrizzleSnapshot,\n drizzle: undefined,\n enums: {},\n features: {\n json: true,\n },\n fieldConstraints: {},\n getDrizzle: args.getDrizzle,\n getMigrationTemplate,\n idType: postgresIDType,\n initializing,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n operators: operatorMap,\n pgSchema: adapterSchema,\n pool: undefined,\n prodMigrations: args.prodMigrations,\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n transactionOptions: args.transactionOptions || undefined,\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction: args.transactionOptions === false ? undefined : beginTransaction,\n commitTransaction,\n connect,\n convertPathToJSONTraversal,\n count,\n countDistinct,\n create,\n createGlobal,\n createGlobalVersion,\n createJSONQuery,\n createMigration,\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n deleteWhere,\n destroy,\n dropDatabase,\n execute,\n find,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n init,\n insert,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n payload,\n queryDrafts,\n rejectInitializing,\n requireDrizzleKit,\n resolveInitializing,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n })\n }\n\n return {\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n"],"names":["nodePostgres","beginTransaction","commitTransaction","count","create","createGlobal","createGlobalVersion","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findMigrationDir","findOne","findVersions","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","operatorMap","queryDrafts","rollbackTransaction","updateGlobal","updateGlobalVersion","updateOne","updateVersion","pgEnum","pgSchema","pgTable","createDatabaseAdapter","connect","countDistinct","convertPathToJSONTraversal","createJSONQuery","createMigration","defaultDrizzleSnapshot","deleteWhere","dropDatabase","execute","getMigrationTemplate","init","insert","requireDrizzleKit","sql","postgresAdapter","args","postgresIDType","idType","payloadIDType","adapter","payload","migrationDir","resolveInitializing","rejectInitializing","adapterSchema","initializing","Promise","res","rej","schemaName","enum","table","name","drizzle","undefined","enums","features","json","fieldConstraints","getDrizzle","localesSuffix","logger","operators","pool","prodMigrations","push","relations","relationshipsSuffix","schema","sessions","tableNameMap","Map","tables","transactionOptions","versionsSuffix","defaultIDType"],"mappings":"AAEA,SAASA,YAAY,QAAQ,sCAAqC;AAElE,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,KAAK,EACLC,MAAM,EACNC,YAAY,EACZC,mBAAmB,EACnBC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,EACnBC,SAAS,EACTC,aAAa,QACR,sBAAqB;AAC5B,SAASC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,sBAAqB;AAC/D,SAASC,qBAAqB,QAAQ,UAAS;AAI/C,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,0BAA0B,QAAQ,kDAAiD;AAC5F,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,MAAM,QAAQ,cAAa;AACpC,SAASC,iBAAiB,QAAQ,yBAAwB;AAI1D,SAASC,GAAG,QAAQ,cAAa;AAEjC,OAAO,SAASC,gBAAgBC,IAAU;IACxC,MAAMC,iBAAiBD,KAAKE,MAAM,IAAI;IACtC,MAAMC,gBAAgBF,mBAAmB,WAAW,WAAW;IAE/D,SAASG,QAAQ,EAAEC,OAAO,EAAwB;QAChD,MAAMC,eAAezC,iBAAiBmC,KAAKM,YAAY;QACvD,IAAIC;QACJ,IAAIC;QACJ,IAAIC;QAEJ,MAAMC,eAAe,IAAIC,QAAc,CAACC,KAAKC;YAC3CN,sBAAsBK;YACtBJ,qBAAqBK;QACvB;QAEA,IAAIb,KAAKc,UAAU,EAAE;YACnBL,gBAAgB3B,SAASkB,KAAKc,UAAU;QAC1C,OAAO;YACLL,gBAAgB;gBAAEM,MAAMlC;gBAAQmC,OAAOjC;YAAQ;QACjD;QAEA,OAAOC,sBAAuC;YAC5CiC,MAAM;YACN3B;YACA4B,SAASC;YACTC,OAAO,CAAC;YACRC,UAAU;gBACRC,MAAM;YACR;YACAC,kBAAkB,CAAC;YACnBC,YAAYxB,KAAKwB,UAAU;YAC3B9B;YACAQ,QAAQD;YACRS;YACAe,eAAezB,KAAKyB,aAAa,IAAI;YACrCC,QAAQ1B,KAAK0B,MAAM;YACnBC,WAAWrD;YACXQ,UAAU2B;YACVmB,MAAMT;YACNU,gBAAgB7B,KAAK6B,cAAc;YACnCC,MAAM9B,KAAK8B,IAAI;YACfC,WAAW,CAAC;YACZC,qBAAqBhC,KAAKgC,mBAAmB,IAAI;YACjDC,QAAQ,CAAC;YACTnB,YAAYd,KAAKc,UAAU;YAC3BoB,UAAU,CAAC;YACXC,cAAc,IAAIC;YAClBC,QAAQ,CAAC;YACTC,oBAAoBtC,KAAKsC,kBAAkB,IAAInB;YAC/CoB,gBAAgBvC,KAAKuC,cAAc,IAAI;YAEvC,kBAAkB;YAClBxF,kBAAkBiD,KAAKsC,kBAAkB,KAAK,QAAQnB,YAAYpE;YAClEC;YACAiC;YACAE;YACAlC;YACAiC;YACAhC;YACAC;YACAC;YACAgC;YACAC;YACAhC;YACAmF,eAAerC;YACf7C;YACAC;YACAC;YACA+B;YACA9B;YACA+B;YACAC;YACA/B;YACAC;YACAC;YACAE;YACAC;YACA4B;YACAC;YACA5B;YACAC;YACAC;YACAC;YACAC;YACAC;YACAiC;YACAD;YACA9B;YACAiC;YACAX;YACAU;YACA/B;YACAC;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO;QACL4D,eAAerC;QACfR,MAAMS;IACR;AACF"}
|
package/dist/init.d.ts
CHANGED
package/dist/init.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA6B,MAAM,SAAS,CAAA;AAU9D,eAAO,MAAM,IAAI,EAAE,IAuFlB,CAAA"}
|
package/dist/init.js
CHANGED
@@ -1,28 +1,29 @@
|
|
1
|
-
|
2
|
-
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload
|
1
|
+
import { createTableName } from '@payloadcms/drizzle';
|
2
|
+
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload';
|
3
|
+
import toSnakeCase from 'to-snake-case';
|
3
4
|
import { buildTable } from './schema/build.js';
|
4
|
-
import { createTableName } from './schema/createTableName.js';
|
5
5
|
export const init = function init() {
|
6
|
-
if (this.schemaName) {
|
7
|
-
this.pgSchema = pgSchema(this.schemaName);
|
8
|
-
} else {
|
9
|
-
this.pgSchema = {
|
10
|
-
table: pgTable
|
11
|
-
};
|
12
|
-
}
|
13
6
|
if (this.payload.config.localization) {
|
14
|
-
this.enums.enum__locales =
|
7
|
+
this.enums.enum__locales = this.pgSchema.enum('_locales', this.payload.config.localization.locales.map(({ code })=>code));
|
15
8
|
}
|
16
9
|
this.payload.config.collections.forEach((collection)=>{
|
17
|
-
|
10
|
+
createTableName({
|
18
11
|
adapter: this,
|
19
12
|
config: collection
|
20
13
|
});
|
14
|
+
if (collection.versions) {
|
15
|
+
createTableName({
|
16
|
+
adapter: this,
|
17
|
+
config: collection,
|
18
|
+
versions: true,
|
19
|
+
versionsCustomName: true
|
20
|
+
});
|
21
|
+
}
|
22
|
+
});
|
23
|
+
this.payload.config.collections.forEach((collection)=>{
|
24
|
+
const tableName = this.tableNameMap.get(toSnakeCase(collection.slug));
|
21
25
|
buildTable({
|
22
26
|
adapter: this,
|
23
|
-
buildNumbers: true,
|
24
|
-
buildRelationships: true,
|
25
|
-
buildTexts: true,
|
26
27
|
disableNotNull: !!collection?.versions?.drafts,
|
27
28
|
disableUnique: false,
|
28
29
|
fields: collection.fields,
|
@@ -31,18 +32,10 @@ export const init = function init() {
|
|
31
32
|
versions: false
|
32
33
|
});
|
33
34
|
if (collection.versions) {
|
34
|
-
const versionsTableName =
|
35
|
-
adapter: this,
|
36
|
-
config: collection,
|
37
|
-
versions: true,
|
38
|
-
versionsCustomName: true
|
39
|
-
});
|
35
|
+
const versionsTableName = this.tableNameMap.get(`_${toSnakeCase(collection.slug)}${this.versionsSuffix}`);
|
40
36
|
const versionFields = buildVersionCollectionFields(collection);
|
41
37
|
buildTable({
|
42
38
|
adapter: this,
|
43
|
-
buildNumbers: true,
|
44
|
-
buildRelationships: true,
|
45
|
-
buildTexts: true,
|
46
39
|
disableNotNull: !!collection.versions?.drafts,
|
47
40
|
disableUnique: true,
|
48
41
|
fields: versionFields,
|
@@ -59,9 +52,6 @@ export const init = function init() {
|
|
59
52
|
});
|
60
53
|
buildTable({
|
61
54
|
adapter: this,
|
62
|
-
buildNumbers: true,
|
63
|
-
buildRelationships: true,
|
64
|
-
buildTexts: true,
|
65
55
|
disableNotNull: !!global?.versions?.drafts,
|
66
56
|
disableUnique: false,
|
67
57
|
fields: global.fields,
|
@@ -79,9 +69,6 @@ export const init = function init() {
|
|
79
69
|
const versionFields = buildVersionGlobalFields(global);
|
80
70
|
buildTable({
|
81
71
|
adapter: this,
|
82
|
-
buildNumbers: true,
|
83
|
-
buildRelationships: true,
|
84
|
-
buildTexts: true,
|
85
72
|
disableNotNull: !!global.versions?.drafts,
|
86
73
|
disableUnique: true,
|
87
74
|
fields: versionFields,
|
package/dist/init.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/init.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"sources":["../src/init.ts"],"sourcesContent":["import type { Init, SanitizedCollectionConfig } from 'payload'\n\nimport { createTableName } from '@payloadcms/drizzle'\nimport { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { buildTable } from './schema/build.js'\n\nexport const init: Init = function init(this: PostgresAdapter) {\n if (this.payload.config.localization) {\n this.enums.enum__locales = this.pgSchema.enum(\n '_locales',\n this.payload.config.localization.locales.map(({ code }) => code) as [string, ...string[]],\n )\n }\n\n this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {\n createTableName({\n adapter: this,\n config: collection,\n })\n\n if (collection.versions) {\n createTableName({\n adapter: this,\n config: collection,\n versions: true,\n versionsCustomName: true,\n })\n }\n })\n this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {\n const tableName = this.tableNameMap.get(toSnakeCase(collection.slug))\n\n buildTable({\n adapter: this,\n disableNotNull: !!collection?.versions?.drafts,\n disableUnique: false,\n fields: collection.fields,\n tableName,\n timestamps: collection.timestamps,\n versions: false,\n })\n\n if (collection.versions) {\n const versionsTableName = this.tableNameMap.get(\n `_${toSnakeCase(collection.slug)}${this.versionsSuffix}`,\n )\n const versionFields = buildVersionCollectionFields(collection)\n\n buildTable({\n adapter: this,\n disableNotNull: !!collection.versions?.drafts,\n disableUnique: true,\n fields: versionFields,\n tableName: versionsTableName,\n timestamps: true,\n versions: true,\n })\n }\n })\n\n this.payload.config.globals.forEach((global) => {\n const tableName = createTableName({ adapter: this, config: global })\n\n buildTable({\n adapter: this,\n disableNotNull: !!global?.versions?.drafts,\n disableUnique: false,\n fields: global.fields,\n tableName,\n timestamps: false,\n versions: false,\n })\n\n if (global.versions) {\n const versionsTableName = createTableName({\n adapter: this,\n config: global,\n versions: true,\n versionsCustomName: true,\n })\n const versionFields = buildVersionGlobalFields(global)\n\n buildTable({\n adapter: this,\n disableNotNull: !!global.versions?.drafts,\n disableUnique: true,\n fields: versionFields,\n tableName: versionsTableName,\n timestamps: true,\n versions: true,\n })\n }\n })\n}\n"],"names":["createTableName","buildVersionCollectionFields","buildVersionGlobalFields","toSnakeCase","buildTable","init","payload","config","localization","enums","enum__locales","pgSchema","enum","locales","map","code","collections","forEach","collection","adapter","versions","versionsCustomName","tableName","tableNameMap","get","slug","disableNotNull","drafts","disableUnique","fields","timestamps","versionsTableName","versionsSuffix","versionFields","globals","global"],"mappings":"AAEA,SAASA,eAAe,QAAQ,sBAAqB;AACrD,SAASC,4BAA4B,EAAEC,wBAAwB,QAAQ,UAAS;AAChF,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,UAAU,QAAQ,oBAAmB;AAE9C,OAAO,MAAMC,OAAa,SAASA;IACjC,IAAI,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpC,IAAI,CAACC,KAAK,CAACC,aAAa,GAAG,IAAI,CAACC,QAAQ,CAACC,IAAI,CAC3C,YACA,IAAI,CAACN,OAAO,CAACC,MAAM,CAACC,YAAY,CAACK,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAE/D;IAEA,IAAI,CAACT,OAAO,CAACC,MAAM,CAACS,WAAW,CAACC,OAAO,CAAC,CAACC;QACvClB,gBAAgB;YACdmB,SAAS,IAAI;YACbZ,QAAQW;QACV;QAEA,IAAIA,WAAWE,QAAQ,EAAE;YACvBpB,gBAAgB;gBACdmB,SAAS,IAAI;gBACbZ,QAAQW;gBACRE,UAAU;gBACVC,oBAAoB;YACtB;QACF;IACF;IACA,IAAI,CAACf,OAAO,CAACC,MAAM,CAACS,WAAW,CAACC,OAAO,CAAC,CAACC;QACvC,MAAMI,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACrB,YAAYe,WAAWO,IAAI;QAEnErB,WAAW;YACTe,SAAS,IAAI;YACbO,gBAAgB,CAAC,CAACR,YAAYE,UAAUO;YACxCC,eAAe;YACfC,QAAQX,WAAWW,MAAM;YACzBP;YACAQ,YAAYZ,WAAWY,UAAU;YACjCV,UAAU;QACZ;QAEA,IAAIF,WAAWE,QAAQ,EAAE;YACvB,MAAMW,oBAAoB,IAAI,CAACR,YAAY,CAACC,GAAG,CAC7C,CAAC,CAAC,EAAErB,YAAYe,WAAWO,IAAI,EAAE,EAAE,IAAI,CAACO,cAAc,CAAC,CAAC;YAE1D,MAAMC,gBAAgBhC,6BAA6BiB;YAEnDd,WAAW;gBACTe,SAAS,IAAI;gBACbO,gBAAgB,CAAC,CAACR,WAAWE,QAAQ,EAAEO;gBACvCC,eAAe;gBACfC,QAAQI;gBACRX,WAAWS;gBACXD,YAAY;gBACZV,UAAU;YACZ;QACF;IACF;IAEA,IAAI,CAACd,OAAO,CAACC,MAAM,CAAC2B,OAAO,CAACjB,OAAO,CAAC,CAACkB;QACnC,MAAMb,YAAYtB,gBAAgB;YAAEmB,SAAS,IAAI;YAAEZ,QAAQ4B;QAAO;QAElE/B,WAAW;YACTe,SAAS,IAAI;YACbO,gBAAgB,CAAC,CAACS,QAAQf,UAAUO;YACpCC,eAAe;YACfC,QAAQM,OAAON,MAAM;YACrBP;YACAQ,YAAY;YACZV,UAAU;QACZ;QAEA,IAAIe,OAAOf,QAAQ,EAAE;YACnB,MAAMW,oBAAoB/B,gBAAgB;gBACxCmB,SAAS,IAAI;gBACbZ,QAAQ4B;gBACRf,UAAU;gBACVC,oBAAoB;YACtB;YACA,MAAMY,gBAAgB/B,yBAAyBiC;YAE/C/B,WAAW;gBACTe,SAAS,IAAI;gBACbO,gBAAgB,CAAC,CAACS,OAAOf,QAAQ,EAAEO;gBACnCC,eAAe;gBACfC,QAAQI;gBACRX,WAAWS;gBACXD,YAAY;gBACZV,UAAU;YACZ;QACF;IACF;AACF,EAAC"}
|
package/dist/insert.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../src/insert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,MAAM,EAAE,MAoBpB,CAAA"}
|
package/dist/insert.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
export const insert = async function insert({ db, onConflictDoUpdate, tableName, values }) {
|
2
|
+
const table = this.tables[tableName];
|
3
|
+
let result;
|
4
|
+
if (onConflictDoUpdate) {
|
5
|
+
result = await db.insert(table).values(values).onConflictDoUpdate(onConflictDoUpdate).returning();
|
6
|
+
} else {
|
7
|
+
result = await db.insert(table).values(values).returning();
|
8
|
+
}
|
9
|
+
return result;
|
10
|
+
};
|
11
|
+
|
12
|
+
//# sourceMappingURL=insert.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/insert.ts"],"sourcesContent":["import type { TransactionPg } from '@payloadcms/drizzle/types'\n\nimport type { Insert } from './types.js'\n\nexport const insert: Insert = async function insert({\n db,\n onConflictDoUpdate,\n tableName,\n values,\n}): Promise<Record<string, unknown>[]> {\n const table = this.tables[tableName]\n let result\n\n if (onConflictDoUpdate) {\n result = await (db as TransactionPg)\n .insert(table)\n .values(values)\n .onConflictDoUpdate(onConflictDoUpdate)\n .returning()\n } else {\n result = await (db as TransactionPg).insert(table).values(values).returning()\n }\n\n return result\n}\n"],"names":["insert","db","onConflictDoUpdate","tableName","values","table","tables","result","returning"],"mappings":"AAIA,OAAO,MAAMA,SAAiB,eAAeA,OAAO,EAClDC,EAAE,EACFC,kBAAkB,EAClBC,SAAS,EACTC,MAAM,EACP;IACC,MAAMC,QAAQ,IAAI,CAACC,MAAM,CAACH,UAAU;IACpC,IAAII;IAEJ,IAAIL,oBAAoB;QACtBK,SAAS,MAAM,AAACN,GACbD,MAAM,CAACK,OACPD,MAAM,CAACA,QACPF,kBAAkB,CAACA,oBACnBM,SAAS;IACd,OAAO;QACLD,SAAS,MAAM,AAACN,GAAqBD,MAAM,CAACK,OAAOD,MAAM,CAACA,QAAQI,SAAS;IAC7E;IAEA,OAAOD;AACT,EAAC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
declare const imports = "import { migratePostgresV2toV3 } from '@payloadcms/db-postgres/migration-utils'";
|
2
|
+
declare const upSQL = " await migratePostgresV2toV3({\n // enables logging of changes that will be made to the database\n debug: false,\n payload,\n req,\n })\n";
|
3
|
+
export { imports, upSQL };
|
4
|
+
//# sourceMappingURL=relationships-v2-v3.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"relationships-v2-v3.d.ts","sourceRoot":"","sources":["../../src/predefinedMigrations/relationships-v2-v3.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,oFAAoF,CAAA;AACjG,QAAA,MAAM,KAAK,mLAMV,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/predefinedMigrations/relationships-v2-v3.ts"],"sourcesContent":["const imports = `import { migratePostgresV2toV3 } from '@payloadcms/db-postgres/migration-utils'`\nconst upSQL = ` await migratePostgresV2toV3({\n // enables logging of changes that will be made to the database\n debug: false,\n payload,\n req,\n })\n`\n\nexport { imports, upSQL }\n"],"names":["imports","upSQL"],"mappings":"AAAA,MAAMA,UAAU,CAAC,+EAA+E,CAAC;AACjG,MAAMC,QAAQ,CAAC;;;;;;AAMf,CAAC;AAED,SAASD,OAAO,EAAEC,KAAK,GAAE"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
const imports = `import { migratePostgresV2toV3 } from '@payloadcms/db-postgres/migration-utils'`;
|
2
|
+
const upSQL = ` await migratePostgresV2toV3({
|
3
|
+
// enables logging of changes that will be made to the database
|
4
|
+
debug: false,
|
5
|
+
payload,
|
6
|
+
req,
|
7
|
+
})
|
8
|
+
`;
|
9
|
+
export { imports, upSQL };
|
10
|
+
|
11
|
+
//# sourceMappingURL=relationships-v2-v3.js.map
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { TransactionPg } from '@payloadcms/drizzle/types';
|
2
|
+
import type { Field, Payload, PayloadRequest } from 'payload';
|
3
|
+
import type { PostgresAdapter } from '../../../types.js';
|
4
|
+
import type { DocsToResave } from '../types.js';
|
5
|
+
type Args = {
|
6
|
+
adapter: PostgresAdapter;
|
7
|
+
collectionSlug?: string;
|
8
|
+
db: TransactionPg;
|
9
|
+
debug: boolean;
|
10
|
+
docsToResave: DocsToResave;
|
11
|
+
fields: Field[];
|
12
|
+
globalSlug?: string;
|
13
|
+
isVersions: boolean;
|
14
|
+
payload: Payload;
|
15
|
+
req: PayloadRequest;
|
16
|
+
tableName: string;
|
17
|
+
};
|
18
|
+
export declare const fetchAndResave: ({ adapter, collectionSlug, db, debug, docsToResave, fields, globalSlug, isVersions, payload, req, tableName, }: Args) => Promise<void>;
|
19
|
+
export {};
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/predefinedMigrations/v2-v3/fetchAndResave/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,EAAE,EAAE,aAAa,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,YAAY,CAAA;IAC1B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,cAAc,mHAYxB,IAAI,kBAwMN,CAAA"}
|
@@ -0,0 +1,169 @@
|
|
1
|
+
import { upsertRow } from '@payloadcms/drizzle';
|
2
|
+
import { traverseFields } from './traverseFields.js';
|
3
|
+
export const fetchAndResave = async ({ adapter, collectionSlug, db, debug, docsToResave, fields, globalSlug, isVersions, payload, req, tableName })=>{
|
4
|
+
for (const [id, rows] of Object.entries(docsToResave)){
|
5
|
+
if (collectionSlug) {
|
6
|
+
const collectionConfig = payload.collections[collectionSlug].config;
|
7
|
+
if (collectionConfig) {
|
8
|
+
if (isVersions) {
|
9
|
+
const doc = await payload.findVersionByID({
|
10
|
+
id,
|
11
|
+
collection: collectionSlug,
|
12
|
+
depth: 0,
|
13
|
+
fallbackLocale: null,
|
14
|
+
locale: 'all',
|
15
|
+
req,
|
16
|
+
showHiddenFields: true
|
17
|
+
});
|
18
|
+
if (debug) {
|
19
|
+
payload.logger.info(`The collection "${collectionConfig.slug}" version with ID ${id} will be migrated`);
|
20
|
+
}
|
21
|
+
traverseFields({
|
22
|
+
doc,
|
23
|
+
fields,
|
24
|
+
path: '',
|
25
|
+
rows
|
26
|
+
});
|
27
|
+
try {
|
28
|
+
await upsertRow({
|
29
|
+
id: doc.id,
|
30
|
+
adapter,
|
31
|
+
data: doc,
|
32
|
+
db,
|
33
|
+
fields,
|
34
|
+
ignoreResult: true,
|
35
|
+
operation: 'update',
|
36
|
+
req,
|
37
|
+
tableName
|
38
|
+
});
|
39
|
+
} catch (err) {
|
40
|
+
payload.logger.error(`"${collectionConfig.slug}" version with ID ${doc.id} FAILED TO MIGRATE`);
|
41
|
+
throw err;
|
42
|
+
}
|
43
|
+
if (debug) {
|
44
|
+
payload.logger.info(`"${collectionConfig.slug}" version with ID ${doc.id} migrated successfully!`);
|
45
|
+
}
|
46
|
+
} else {
|
47
|
+
const doc = await payload.findByID({
|
48
|
+
id,
|
49
|
+
collection: collectionSlug,
|
50
|
+
depth: 0,
|
51
|
+
fallbackLocale: null,
|
52
|
+
locale: 'all',
|
53
|
+
req,
|
54
|
+
showHiddenFields: true
|
55
|
+
});
|
56
|
+
if (debug) {
|
57
|
+
payload.logger.info(`The collection "${collectionConfig.slug}" with ID ${doc.id} will be migrated`);
|
58
|
+
}
|
59
|
+
traverseFields({
|
60
|
+
doc,
|
61
|
+
fields,
|
62
|
+
path: '',
|
63
|
+
rows
|
64
|
+
});
|
65
|
+
try {
|
66
|
+
await upsertRow({
|
67
|
+
id: doc.id,
|
68
|
+
adapter,
|
69
|
+
data: doc,
|
70
|
+
db,
|
71
|
+
fields,
|
72
|
+
ignoreResult: true,
|
73
|
+
operation: 'update',
|
74
|
+
req,
|
75
|
+
tableName
|
76
|
+
});
|
77
|
+
} catch (err) {
|
78
|
+
payload.logger.error(`The collection "${collectionConfig.slug}" with ID ${doc.id} has FAILED TO MIGRATE`);
|
79
|
+
throw err;
|
80
|
+
}
|
81
|
+
if (debug) {
|
82
|
+
payload.logger.info(`The collection "${collectionConfig.slug}" with ID ${doc.id} has migrated successfully!`);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
if (globalSlug) {
|
88
|
+
const globalConfig = payload.config.globals?.find((global)=>global.slug === globalSlug);
|
89
|
+
if (globalConfig) {
|
90
|
+
if (isVersions) {
|
91
|
+
const { docs } = await payload.findGlobalVersions({
|
92
|
+
slug: globalSlug,
|
93
|
+
depth: 0,
|
94
|
+
fallbackLocale: null,
|
95
|
+
limit: 0,
|
96
|
+
locale: 'all',
|
97
|
+
req,
|
98
|
+
showHiddenFields: true
|
99
|
+
});
|
100
|
+
if (debug) {
|
101
|
+
payload.logger.info(`${docs.length} global "${globalSlug}" versions will be migrated`);
|
102
|
+
}
|
103
|
+
for (const doc of docs){
|
104
|
+
traverseFields({
|
105
|
+
doc,
|
106
|
+
fields,
|
107
|
+
path: '',
|
108
|
+
rows
|
109
|
+
});
|
110
|
+
try {
|
111
|
+
await upsertRow({
|
112
|
+
id: doc.id,
|
113
|
+
adapter,
|
114
|
+
data: doc,
|
115
|
+
db,
|
116
|
+
fields,
|
117
|
+
ignoreResult: true,
|
118
|
+
operation: 'update',
|
119
|
+
req,
|
120
|
+
tableName
|
121
|
+
});
|
122
|
+
} catch (err) {
|
123
|
+
payload.logger.error(`"${globalSlug}" version with ID ${doc.id} FAILED TO MIGRATE`);
|
124
|
+
throw err;
|
125
|
+
}
|
126
|
+
if (debug) {
|
127
|
+
payload.logger.info(`"${globalSlug}" version with ID ${doc.id} migrated successfully!`);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
} else {
|
131
|
+
const doc = await payload.findGlobal({
|
132
|
+
slug: globalSlug,
|
133
|
+
depth: 0,
|
134
|
+
fallbackLocale: null,
|
135
|
+
locale: 'all',
|
136
|
+
req,
|
137
|
+
showHiddenFields: true
|
138
|
+
});
|
139
|
+
traverseFields({
|
140
|
+
doc,
|
141
|
+
fields,
|
142
|
+
path: '',
|
143
|
+
rows
|
144
|
+
});
|
145
|
+
try {
|
146
|
+
await upsertRow({
|
147
|
+
adapter,
|
148
|
+
data: doc,
|
149
|
+
db,
|
150
|
+
fields,
|
151
|
+
ignoreResult: true,
|
152
|
+
operation: 'update',
|
153
|
+
req,
|
154
|
+
tableName
|
155
|
+
});
|
156
|
+
} catch (err) {
|
157
|
+
payload.logger.error(`The global "${globalSlug}" has FAILED TO MIGRATE`);
|
158
|
+
throw err;
|
159
|
+
}
|
160
|
+
if (debug) {
|
161
|
+
payload.logger.info(`The global "${globalSlug}" has migrated successfully!`);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}
|
167
|
+
};
|
168
|
+
|
169
|
+
//# sourceMappingURL=index.js.map
|