@payloadcms/db-postgres 3.0.0-canary.3bd3027 → 3.0.0-canary.5390729
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.js.map +1 -1
- package/dist/count.js.map +1 -1
- package/dist/create.js.map +1 -1
- package/dist/createGlobal.d.ts +2 -2
- package/dist/createGlobal.d.ts.map +1 -1
- package/dist/createGlobal.js.map +1 -1
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createMigration.js.map +1 -1
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteMany.js.map +1 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/deleteVersions.js.map +1 -1
- package/dist/destroy.js.map +1 -1
- package/dist/exports/migration-utils.js.map +1 -1
- package/dist/find/buildFindManyArgs.js.map +1 -1
- package/dist/find/chainMethods.js.map +1 -1
- package/dist/find/findMany.js.map +1 -1
- package/dist/find/traverseFields.js.map +1 -1
- package/dist/find.js.map +1 -1
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init.js.map +1 -1
- package/dist/migrate.js.map +1 -1
- package/dist/migrateDown.js.map +1 -1
- package/dist/migrateFresh.js.map +1 -1
- package/dist/migrateRefresh.js.map +1 -1
- package/dist/migrateReset.js.map +1 -1
- package/dist/migrateStatus.js.map +1 -1
- package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +0 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/index.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -1
- package/dist/predefinedMigrations/v2-v3/types.js.map +1 -1
- package/dist/queries/buildAndOrConditions.js.map +1 -1
- package/dist/queries/buildQuery.js.map +1 -1
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +1 -1
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +1 -1
- package/dist/queries/createJSONQuery/index.js.map +1 -1
- package/dist/queries/getTableColumnFromPath.js.map +1 -1
- package/dist/queries/operatorMap.js.map +1 -1
- package/dist/queries/parseParams.js.map +1 -1
- package/dist/queries/sanitizeQueryValue.js.map +1 -1
- package/dist/queries/selectDistinct.js.map +1 -1
- package/dist/queryDrafts.js.map +1 -1
- package/dist/schema/build.js.map +1 -1
- package/dist/schema/createIndex.js.map +1 -1
- package/dist/schema/createTableName.js.map +1 -1
- package/dist/schema/idToUUID.js.map +1 -1
- package/dist/schema/parentIDColumnMap.js.map +1 -1
- package/dist/schema/setColumnID.js.map +1 -1
- package/dist/schema/traverseFields.js.map +1 -1
- package/dist/schema/validateExistingBlockIsIdentical.js.map +1 -1
- package/dist/transactions/beginTransaction.js.map +1 -1
- package/dist/transactions/commitTransaction.js.map +1 -1
- package/dist/transactions/rollbackTransaction.js.map +1 -1
- package/dist/transform/read/hasManyNumber.js.map +1 -1
- package/dist/transform/read/hasManyText.js.map +1 -1
- package/dist/transform/read/index.d.ts +2 -3
- package/dist/transform/read/index.d.ts.map +1 -1
- package/dist/transform/read/index.js.map +1 -1
- package/dist/transform/read/relationship.js.map +1 -1
- package/dist/transform/read/traverseFields.js.map +1 -1
- package/dist/transform/write/array.js.map +1 -1
- package/dist/transform/write/blocks.js.map +1 -1
- package/dist/transform/write/index.js.map +1 -1
- package/dist/transform/write/numbers.js.map +1 -1
- package/dist/transform/write/relationships.js.map +1 -1
- package/dist/transform/write/selects.js.map +1 -1
- package/dist/transform/write/texts.js.map +1 -1
- package/dist/transform/write/traverseFields.js.map +1 -1
- package/dist/transform/write/types.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update.js.map +1 -1
- package/dist/updateGlobal.d.ts +2 -2
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateGlobalVersion.js.map +1 -1
- package/dist/updateVersion.js.map +1 -1
- package/dist/upsertRow/deleteExistingArrayRows.js.map +1 -1
- package/dist/upsertRow/deleteExistingRowsByPath.js.map +1 -1
- package/dist/upsertRow/index.d.ts +1 -1
- package/dist/upsertRow/index.d.ts.map +1 -1
- package/dist/upsertRow/index.js.map +1 -1
- package/dist/upsertRow/insertArrays.js.map +1 -1
- package/dist/upsertRow/types.js.map +1 -1
- package/dist/utilities/appendPrefixToKeys.js.map +1 -1
- package/dist/utilities/createBlocksMap.js.map +1 -1
- package/dist/utilities/createMigrationTable.js.map +1 -1
- package/dist/utilities/createRelationshipMap.js.map +1 -1
- package/dist/utilities/hasLocalesTable.js.map +1 -1
- package/dist/utilities/isArrayOfRows.js.map +1 -1
- package/dist/utilities/migrationTableExists.js.map +1 -1
- package/dist/utilities/parseError.js.map +1 -1
- package/dist/utilities/pushDevSchema.js.map +1 -1
- package/package.json +4 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/migrationTableExists.ts"],"sourcesContent":["import { sql } from 'drizzle-orm'\n\nimport type { DrizzleDB } from '../types.js'\n\nexport const migrationTableExists = async (db: DrizzleDB): Promise<boolean> => {\n const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`)\n\n // Returns table name 'payload_migrations' or null\n const exists = queryRes.rows?.[0]?.to_regclass === 'payload_migrations'\n return exists\n}\n"],"names":["sql","migrationTableExists","db","queryRes","execute","exists","rows","to_regclass"],"
|
1
|
+
{"version":3,"sources":["../../src/utilities/migrationTableExists.ts"],"sourcesContent":["import { sql } from 'drizzle-orm'\n\nimport type { DrizzleDB } from '../types.js'\n\nexport const migrationTableExists = async (db: DrizzleDB): Promise<boolean> => {\n const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`)\n\n // Returns table name 'payload_migrations' or null\n const exists = queryRes.rows?.[0]?.to_regclass === 'payload_migrations'\n return exists\n}\n"],"names":["sql","migrationTableExists","db","queryRes","execute","exists","rows","to_regclass"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAa;AAIjC,OAAO,MAAMC,uBAAuB,OAAOC;IACzC,MAAMC,WAAW,MAAMD,GAAGE,OAAO,CAACJ,GAAG,CAAC,gDAAgD,CAAC;IAEvF,kDAAkD;IAClD,MAAMK,SAASF,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEC,gBAAgB;IACnD,OAAOF;AACT,EAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/parseError.ts"],"sourcesContent":["import pg from 'pg'\nconst { DatabaseError } = pg\n\n/**\n * Format error message with hint if available\n */\nexport const parseError = (err: unknown, msg: string): string => {\n let formattedMsg = `${msg}`\n if (err instanceof Error) {\n formattedMsg += ` ${err.message}.`\n if (err instanceof DatabaseError) {\n msg += `: ${err.message}`\n if (err.hint) msg += ` ${err.hint}.`\n }\n }\n return formattedMsg\n}\n"],"names":["pg","DatabaseError","parseError","err","msg","formattedMsg","Error","message","hint"],"
|
1
|
+
{"version":3,"sources":["../../src/utilities/parseError.ts"],"sourcesContent":["import pg from 'pg'\nconst { DatabaseError } = pg\n\n/**\n * Format error message with hint if available\n */\nexport const parseError = (err: unknown, msg: string): string => {\n let formattedMsg = `${msg}`\n if (err instanceof Error) {\n formattedMsg += ` ${err.message}.`\n if (err instanceof DatabaseError) {\n msg += `: ${err.message}`\n if (err.hint) msg += ` ${err.hint}.`\n }\n }\n return formattedMsg\n}\n"],"names":["pg","DatabaseError","parseError","err","msg","formattedMsg","Error","message","hint"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAE1B;;CAEC,GACD,OAAO,MAAME,aAAa,CAACC,KAAcC;IACvC,IAAIC,eAAe,CAAC,EAAED,IAAI,CAAC;IAC3B,IAAID,eAAeG,OAAO;QACxBD,gBAAgB,CAAC,CAAC,EAAEF,IAAII,OAAO,CAAC,CAAC,CAAC;QAClC,IAAIJ,eAAeF,eAAe;YAChCG,OAAO,CAAC,EAAE,EAAED,IAAII,OAAO,CAAC,CAAC;YACzB,IAAIJ,IAAIK,IAAI,EAAEJ,OAAO,CAAC,CAAC,EAAED,IAAIK,IAAI,CAAC,CAAC,CAAC;QACtC;IACF;IACA,OAAOH;AACT,EAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/pushDevSchema.ts"],"sourcesContent":["import { eq } from 'drizzle-orm'\nimport { numeric, timestamp, varchar } from 'drizzle-orm/pg-core'\nimport { createRequire } from 'module'\nimport prompts from 'prompts'\n\nimport type { PostgresAdapter } from '../types.js'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Pushes the development schema to the database using Drizzle.\n *\n * @param {PostgresAdapter} db - The PostgresAdapter instance connected to the database.\n * @returns {Promise<void>} - A promise that resolves once the schema push is complete.\n */\nexport const pushDevSchema = async (db: PostgresAdapter) => {\n const { pushSchema } = require('drizzle-kit/payload')\n\n // This will prompt if clarifications are needed for Drizzle to push new schema\n const { apply, hasDataLoss, warnings } = await pushSchema(db.schema, db.drizzle)\n\n if (warnings.length) {\n let message = `Warnings detected during schema push: \\n\\n${warnings.join('\\n')}\\n\\n`\n\n if (hasDataLoss) {\n message += `DATA LOSS WARNING: Possible data loss detected if schema is pushed.\\n\\n`\n }\n\n message += `Accept warnings and push schema to database?`\n\n const { confirm: acceptWarnings } = await prompts(\n {\n name: 'confirm',\n type: 'confirm',\n initial: false,\n message,\n },\n {\n onCancel: () => {\n process.exit(0)\n },\n },\n )\n\n // Exit if user does not accept warnings.\n // Q: Is this the right type of exit for this interaction?\n if (!acceptWarnings) {\n process.exit(0)\n }\n }\n\n await apply()\n\n // Migration table def in order to use query using drizzle\n const migrationsSchema = db.pgSchema.table('payload_migrations', {\n name: varchar('name'),\n batch: numeric('batch'),\n created_at: timestamp('created_at'),\n updated_at: timestamp('updated_at'),\n })\n\n const devPush = await db.drizzle\n .select()\n .from(migrationsSchema)\n .where(eq(migrationsSchema.batch, '-1'))\n\n if (!devPush.length) {\n await db.drizzle.insert(migrationsSchema).values({\n name: 'dev',\n batch: '-1',\n })\n } else {\n await db.drizzle\n .update(migrationsSchema)\n .set({\n updated_at: new Date(),\n })\n .where(eq(migrationsSchema.batch, '-1'))\n }\n}\n"],"names":["eq","numeric","timestamp","varchar","createRequire","prompts","require","url","pushDevSchema","db","pushSchema","apply","hasDataLoss","warnings","schema","drizzle","length","message","join","confirm","acceptWarnings","name","type","initial","onCancel","process","exit","migrationsSchema","pgSchema","table","batch","created_at","updated_at","devPush","select","from","where","insert","values","update","set","Date"],"
|
1
|
+
{"version":3,"sources":["../../src/utilities/pushDevSchema.ts"],"sourcesContent":["import { eq } from 'drizzle-orm'\nimport { numeric, timestamp, varchar } from 'drizzle-orm/pg-core'\nimport { createRequire } from 'module'\nimport prompts from 'prompts'\n\nimport type { PostgresAdapter } from '../types.js'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Pushes the development schema to the database using Drizzle.\n *\n * @param {PostgresAdapter} db - The PostgresAdapter instance connected to the database.\n * @returns {Promise<void>} - A promise that resolves once the schema push is complete.\n */\nexport const pushDevSchema = async (db: PostgresAdapter) => {\n const { pushSchema } = require('drizzle-kit/payload')\n\n // This will prompt if clarifications are needed for Drizzle to push new schema\n const { apply, hasDataLoss, warnings } = await pushSchema(db.schema, db.drizzle)\n\n if (warnings.length) {\n let message = `Warnings detected during schema push: \\n\\n${warnings.join('\\n')}\\n\\n`\n\n if (hasDataLoss) {\n message += `DATA LOSS WARNING: Possible data loss detected if schema is pushed.\\n\\n`\n }\n\n message += `Accept warnings and push schema to database?`\n\n const { confirm: acceptWarnings } = await prompts(\n {\n name: 'confirm',\n type: 'confirm',\n initial: false,\n message,\n },\n {\n onCancel: () => {\n process.exit(0)\n },\n },\n )\n\n // Exit if user does not accept warnings.\n // Q: Is this the right type of exit for this interaction?\n if (!acceptWarnings) {\n process.exit(0)\n }\n }\n\n await apply()\n\n // Migration table def in order to use query using drizzle\n const migrationsSchema = db.pgSchema.table('payload_migrations', {\n name: varchar('name'),\n batch: numeric('batch'),\n created_at: timestamp('created_at'),\n updated_at: timestamp('updated_at'),\n })\n\n const devPush = await db.drizzle\n .select()\n .from(migrationsSchema)\n .where(eq(migrationsSchema.batch, '-1'))\n\n if (!devPush.length) {\n await db.drizzle.insert(migrationsSchema).values({\n name: 'dev',\n batch: '-1',\n })\n } else {\n await db.drizzle\n .update(migrationsSchema)\n .set({\n updated_at: new Date(),\n })\n .where(eq(migrationsSchema.batch, '-1'))\n }\n}\n"],"names":["eq","numeric","timestamp","varchar","createRequire","prompts","require","url","pushDevSchema","db","pushSchema","apply","hasDataLoss","warnings","schema","drizzle","length","message","join","confirm","acceptWarnings","name","type","initial","onCancel","process","exit","migrationsSchema","pgSchema","table","batch","created_at","updated_at","devPush","select","from","where","insert","values","update","set","Date"],"mappings":"AAAA,SAASA,EAAE,QAAQ,cAAa;AAChC,SAASC,OAAO,EAAEC,SAAS,EAAEC,OAAO,QAAQ,sBAAqB;AACjE,SAASC,aAAa,QAAQ,SAAQ;AACtC,OAAOC,aAAa,UAAS;AAI7B,MAAMC,UAAUF,cAAc,YAAYG,GAAG;AAE7C;;;;;CAKC,GACD,OAAO,MAAMC,gBAAgB,OAAOC;IAClC,MAAM,EAAEC,UAAU,EAAE,GAAGJ,QAAQ;IAE/B,+EAA+E;IAC/E,MAAM,EAAEK,KAAK,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAAG,MAAMH,WAAWD,GAAGK,MAAM,EAAEL,GAAGM,OAAO;IAE/E,IAAIF,SAASG,MAAM,EAAE;QACnB,IAAIC,UAAU,CAAC,0CAA0C,EAAEJ,SAASK,IAAI,CAAC,MAAM,IAAI,CAAC;QAEpF,IAAIN,aAAa;YACfK,WAAW,CAAC,uEAAuE,CAAC;QACtF;QAEAA,WAAW,CAAC,4CAA4C,CAAC;QAEzD,MAAM,EAAEE,SAASC,cAAc,EAAE,GAAG,MAAMf,QACxC;YACEgB,MAAM;YACNC,MAAM;YACNC,SAAS;YACTN;QACF,GACA;YACEO,UAAU;gBACRC,QAAQC,IAAI,CAAC;YACf;QACF;QAGF,yCAAyC;QACzC,0DAA0D;QAC1D,IAAI,CAACN,gBAAgB;YACnBK,QAAQC,IAAI,CAAC;QACf;IACF;IAEA,MAAMf;IAEN,0DAA0D;IAC1D,MAAMgB,mBAAmBlB,GAAGmB,QAAQ,CAACC,KAAK,CAAC,sBAAsB;QAC/DR,MAAMlB,QAAQ;QACd2B,OAAO7B,QAAQ;QACf8B,YAAY7B,UAAU;QACtB8B,YAAY9B,UAAU;IACxB;IAEA,MAAM+B,UAAU,MAAMxB,GAAGM,OAAO,CAC7BmB,MAAM,GACNC,IAAI,CAACR,kBACLS,KAAK,CAACpC,GAAG2B,iBAAiBG,KAAK,EAAE;IAEpC,IAAI,CAACG,QAAQjB,MAAM,EAAE;QACnB,MAAMP,GAAGM,OAAO,CAACsB,MAAM,CAACV,kBAAkBW,MAAM,CAAC;YAC/CjB,MAAM;YACNS,OAAO;QACT;IACF,OAAO;QACL,MAAMrB,GAAGM,OAAO,CACbwB,MAAM,CAACZ,kBACPa,GAAG,CAAC;YACHR,YAAY,IAAIS;QAClB,GACCL,KAAK,CAACpC,GAAG2B,iBAAiBG,KAAK,EAAE;IACtC;AACF,EAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@payloadcms/db-postgres",
|
3
|
-
"version": "3.0.0-canary.
|
3
|
+
"version": "3.0.0-canary.5390729",
|
4
4
|
"description": "The officially supported Postgres database adapter for Payload",
|
5
5
|
"homepage": "https://payloadcms.com",
|
6
6
|
"repository": {
|
@@ -49,11 +49,11 @@
|
|
49
49
|
"@types/pg": "8.10.2",
|
50
50
|
"@types/to-snake-case": "1.0.0",
|
51
51
|
"esbuild": "^0.21.4",
|
52
|
-
"
|
53
|
-
"
|
52
|
+
"payload": "3.0.0-canary.5390729",
|
53
|
+
"@payloadcms/eslint-config": "1.1.1"
|
54
54
|
},
|
55
55
|
"peerDependencies": {
|
56
|
-
"payload": "3.0.0-canary.
|
56
|
+
"payload": "3.0.0-canary.5390729"
|
57
57
|
},
|
58
58
|
"scripts": {
|
59
59
|
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
|