@payloadcms/db-postgres 3.0.0-canary.ee6d727 → 3.0.0-canary.f118ee4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. package/README.md +1 -1
  2. package/dist/connect.d.ts +1 -1
  3. package/dist/connect.d.ts.map +1 -1
  4. package/dist/connect.js +10 -6
  5. package/dist/connect.js.map +1 -1
  6. package/dist/exports/migration-utils.js.map +1 -1
  7. package/dist/index.d.ts +1 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +31 -67
  10. package/dist/index.js.map +1 -1
  11. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -1
  12. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +5 -5
  13. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  14. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +1 -2
  15. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
  16. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +1 -1
  17. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
  18. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +1 -1
  19. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
  20. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
  21. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -1
  22. package/dist/predefinedMigrations/v2-v3/index.d.ts +2 -3
  23. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
  24. package/dist/predefinedMigrations/v2-v3/index.js +7 -7
  25. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -1
  26. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +5 -4
  27. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
  28. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -1
  29. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +4 -4
  30. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
  31. package/dist/predefinedMigrations/v2-v3/traverseFields.js +1 -1
  32. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -1
  33. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -1
  34. package/dist/types.d.ts +42 -80
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/types.js.map +1 -1
  37. package/package.json +20 -17
  38. package/dist/count.d.ts +0 -3
  39. package/dist/count.d.ts.map +0 -1
  40. package/dist/count.js +0 -41
  41. package/dist/count.js.map +0 -1
  42. package/dist/create.d.ts +0 -3
  43. package/dist/create.d.ts.map +0 -1
  44. package/dist/create.js +0 -19
  45. package/dist/create.js.map +0 -1
  46. package/dist/createGlobal.d.ts +0 -5
  47. package/dist/createGlobal.d.ts.map +0 -1
  48. package/dist/createGlobal.js +0 -19
  49. package/dist/createGlobal.js.map +0 -1
  50. package/dist/createGlobalVersion.d.ts +0 -6
  51. package/dist/createGlobalVersion.d.ts.map +0 -1
  52. package/dist/createGlobalVersion.js +0 -33
  53. package/dist/createGlobalVersion.js.map +0 -1
  54. package/dist/createMigration.d.ts +0 -3
  55. package/dist/createMigration.d.ts.map +0 -1
  56. package/dist/createMigration.js +0 -102
  57. package/dist/createMigration.js.map +0 -1
  58. package/dist/createVersion.d.ts +0 -5
  59. package/dist/createVersion.d.ts.map +0 -1
  60. package/dist/createVersion.js +0 -40
  61. package/dist/createVersion.js.map +0 -1
  62. package/dist/deleteMany.d.ts +0 -3
  63. package/dist/deleteMany.d.ts.map +0 -1
  64. package/dist/deleteMany.js +0 -28
  65. package/dist/deleteMany.js.map +0 -1
  66. package/dist/deleteOne.d.ts +0 -3
  67. package/dist/deleteOne.d.ts.map +0 -1
  68. package/dist/deleteOne.js +0 -59
  69. package/dist/deleteOne.js.map +0 -1
  70. package/dist/deleteVersions.d.ts +0 -3
  71. package/dist/deleteVersions.d.ts.map +0 -1
  72. package/dist/deleteVersions.js +0 -31
  73. package/dist/deleteVersions.js.map +0 -1
  74. package/dist/destroy.d.ts +0 -3
  75. package/dist/destroy.d.ts.map +0 -1
  76. package/dist/destroy.js +0 -15
  77. package/dist/destroy.js.map +0 -1
  78. package/dist/find/buildFindManyArgs.d.ts +0 -17
  79. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  80. package/dist/find/buildFindManyArgs.js +0 -65
  81. package/dist/find/buildFindManyArgs.js.map +0 -1
  82. package/dist/find/chainMethods.d.ts +0 -16
  83. package/dist/find/chainMethods.d.ts.map +0 -1
  84. package/dist/find/chainMethods.js +0 -12
  85. package/dist/find/chainMethods.js.map +0 -1
  86. package/dist/find/findMany.d.ts +0 -22
  87. package/dist/find/findMany.d.ts.map +0 -1
  88. package/dist/find/findMany.js +0 -152
  89. package/dist/find/findMany.js.map +0 -1
  90. package/dist/find/traverseFields.d.ts +0 -17
  91. package/dist/find/traverseFields.d.ts.map +0 -1
  92. package/dist/find/traverseFields.js +0 -156
  93. package/dist/find/traverseFields.js.map +0 -1
  94. package/dist/find.d.ts +0 -3
  95. package/dist/find.d.ts.map +0 -1
  96. package/dist/find.js +0 -21
  97. package/dist/find.js.map +0 -1
  98. package/dist/findGlobal.d.ts +0 -3
  99. package/dist/findGlobal.d.ts.map +0 -1
  100. package/dist/findGlobal.js +0 -23
  101. package/dist/findGlobal.js.map +0 -1
  102. package/dist/findGlobalVersions.d.ts +0 -3
  103. package/dist/findGlobalVersions.d.ts.map +0 -1
  104. package/dist/findGlobalVersions.js +0 -24
  105. package/dist/findGlobalVersions.js.map +0 -1
  106. package/dist/findOne.d.ts +0 -5
  107. package/dist/findOne.d.ts.map +0 -1
  108. package/dist/findOne.js +0 -21
  109. package/dist/findOne.js.map +0 -1
  110. package/dist/findVersions.d.ts +0 -3
  111. package/dist/findVersions.d.ts.map +0 -1
  112. package/dist/findVersions.js +0 -24
  113. package/dist/findVersions.js.map +0 -1
  114. package/dist/init.d.ts +0 -3
  115. package/dist/init.d.ts.map +0 -1
  116. package/dist/init.js +0 -91
  117. package/dist/init.js.map +0 -1
  118. package/dist/migrate.d.ts +0 -3
  119. package/dist/migrate.d.ts.map +0 -1
  120. package/dist/migrate.js +0 -99
  121. package/dist/migrate.js.map +0 -1
  122. package/dist/migrateDown.d.ts +0 -3
  123. package/dist/migrateDown.d.ts.map +0 -1
  124. package/dist/migrateDown.js +0 -63
  125. package/dist/migrateDown.js.map +0 -1
  126. package/dist/migrateFresh.d.ts +0 -8
  127. package/dist/migrateFresh.d.ts.map +0 -1
  128. package/dist/migrateFresh.js +0 -72
  129. package/dist/migrateFresh.js.map +0 -1
  130. package/dist/migrateRefresh.d.ts +0 -6
  131. package/dist/migrateRefresh.d.ts.map +0 -1
  132. package/dist/migrateRefresh.js +0 -102
  133. package/dist/migrateRefresh.js.map +0 -1
  134. package/dist/migrateReset.d.ts +0 -6
  135. package/dist/migrateReset.d.ts.map +0 -1
  136. package/dist/migrateReset.js +0 -82
  137. package/dist/migrateReset.js.map +0 -1
  138. package/dist/migrateStatus.d.ts +0 -3
  139. package/dist/migrateStatus.d.ts.map +0 -1
  140. package/dist/migrateStatus.js +0 -44
  141. package/dist/migrateStatus.js.map +0 -1
  142. package/dist/queries/buildAndOrConditions.d.ts +0 -16
  143. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  144. package/dist/queries/buildAndOrConditions.js +0 -28
  145. package/dist/queries/buildAndOrConditions.js.map +0 -1
  146. package/dist/queries/buildQuery.d.ts +0 -30
  147. package/dist/queries/buildQuery.d.ts.map +0 -1
  148. package/dist/queries/buildQuery.js +0 -72
  149. package/dist/queries/buildQuery.js.map +0 -1
  150. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
  151. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  152. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
  153. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  154. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
  155. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  156. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
  157. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  158. package/dist/queries/createJSONQuery/index.d.ts +0 -10
  159. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  160. package/dist/queries/createJSONQuery/index.js +0 -54
  161. package/dist/queries/createJSONQuery/index.js.map +0 -1
  162. package/dist/queries/getTableColumnFromPath.d.ts +0 -50
  163. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  164. package/dist/queries/getTableColumnFromPath.js +0 -517
  165. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  166. package/dist/queries/operatorMap.d.ts +0 -18
  167. package/dist/queries/operatorMap.d.ts.map +0 -1
  168. package/dist/queries/operatorMap.js +0 -24
  169. package/dist/queries/operatorMap.js.map +0 -1
  170. package/dist/queries/parseParams.d.ts +0 -16
  171. package/dist/queries/parseParams.d.ts.map +0 -1
  172. package/dist/queries/parseParams.js +0 -183
  173. package/dist/queries/parseParams.js.map +0 -1
  174. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  175. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  176. package/dist/queries/sanitizeQueryValue.js +0 -90
  177. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  178. package/dist/queries/selectDistinct.d.ts +0 -22
  179. package/dist/queries/selectDistinct.d.ts.map +0 -1
  180. package/dist/queries/selectDistinct.js +0 -30
  181. package/dist/queries/selectDistinct.js.map +0 -1
  182. package/dist/queryDrafts.d.ts +0 -3
  183. package/dist/queryDrafts.d.ts.map +0 -1
  184. package/dist/queryDrafts.js +0 -41
  185. package/dist/queryDrafts.js.map +0 -1
  186. package/dist/schema/build.d.ts +0 -34
  187. package/dist/schema/build.d.ts.map +0 -1
  188. package/dist/schema/build.js +0 -369
  189. package/dist/schema/build.js.map +0 -1
  190. package/dist/schema/createIndex.d.ts +0 -12
  191. package/dist/schema/createIndex.d.ts.map +0 -1
  192. package/dist/schema/createIndex.js +0 -18
  193. package/dist/schema/createIndex.js.map +0 -1
  194. package/dist/schema/createTableName.d.ts +0 -30
  195. package/dist/schema/createTableName.d.ts.map +0 -1
  196. package/dist/schema/createTableName.js +0 -31
  197. package/dist/schema/createTableName.js.map +0 -1
  198. package/dist/schema/idToUUID.d.ts +0 -3
  199. package/dist/schema/idToUUID.d.ts.map +0 -1
  200. package/dist/schema/idToUUID.js +0 -11
  201. package/dist/schema/idToUUID.js.map +0 -1
  202. package/dist/schema/parentIDColumnMap.d.ts +0 -4
  203. package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
  204. package/dist/schema/parentIDColumnMap.js +0 -9
  205. package/dist/schema/parentIDColumnMap.js.map +0 -1
  206. package/dist/schema/setColumnID.d.ts +0 -11
  207. package/dist/schema/setColumnID.d.ts.map +0 -1
  208. package/dist/schema/setColumnID.js +0 -24
  209. package/dist/schema/setColumnID.js.map +0 -1
  210. package/dist/schema/traverseFields.d.ts +0 -36
  211. package/dist/schema/traverseFields.d.ts.map +0 -1
  212. package/dist/schema/traverseFields.js +0 -614
  213. package/dist/schema/traverseFields.js.map +0 -1
  214. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
  215. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  216. package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
  217. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  218. package/dist/transactions/beginTransaction.d.ts +0 -3
  219. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  220. package/dist/transactions/beginTransaction.js +0 -51
  221. package/dist/transactions/beginTransaction.js.map +0 -1
  222. package/dist/transactions/commitTransaction.d.ts +0 -3
  223. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  224. package/dist/transactions/commitTransaction.js +0 -14
  225. package/dist/transactions/commitTransaction.js.map +0 -1
  226. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  227. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  228. package/dist/transactions/rollbackTransaction.js +0 -13
  229. package/dist/transactions/rollbackTransaction.js.map +0 -1
  230. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  231. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  232. package/dist/transform/read/hasManyNumber.js +0 -10
  233. package/dist/transform/read/hasManyNumber.js.map +0 -1
  234. package/dist/transform/read/hasManyText.d.ts +0 -10
  235. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  236. package/dist/transform/read/hasManyText.js +0 -10
  237. package/dist/transform/read/hasManyText.js.map +0 -1
  238. package/dist/transform/read/index.d.ts +0 -14
  239. package/dist/transform/read/index.d.ts.map +0 -1
  240. package/dist/transform/read/index.js +0 -44
  241. package/dist/transform/read/index.js.map +0 -1
  242. package/dist/transform/read/relationship.d.ts +0 -10
  243. package/dist/transform/read/relationship.d.ts.map +0 -1
  244. package/dist/transform/read/relationship.js +0 -60
  245. package/dist/transform/read/relationship.js.map +0 -1
  246. package/dist/transform/read/traverseFields.d.ts +0 -57
  247. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  248. package/dist/transform/read/traverseFields.js +0 -435
  249. package/dist/transform/read/traverseFields.js.map +0 -1
  250. package/dist/transform/write/array.d.ts +0 -26
  251. package/dist/transform/write/array.d.ts.map +0 -1
  252. package/dist/transform/write/array.js +0 -58
  253. package/dist/transform/write/array.js.map +0 -1
  254. package/dist/transform/write/blocks.d.ts +0 -25
  255. package/dist/transform/write/blocks.d.ts.map +0 -1
  256. package/dist/transform/write/blocks.js +0 -54
  257. package/dist/transform/write/blocks.js.map +0 -1
  258. package/dist/transform/write/index.d.ts +0 -13
  259. package/dist/transform/write/index.d.ts.map +0 -1
  260. package/dist/transform/write/index.js +0 -41
  261. package/dist/transform/write/index.js.map +0 -1
  262. package/dist/transform/write/numbers.d.ts +0 -8
  263. package/dist/transform/write/numbers.d.ts.map +0 -1
  264. package/dist/transform/write/numbers.js +0 -11
  265. package/dist/transform/write/numbers.js.map +0 -1
  266. package/dist/transform/write/relationships.d.ts +0 -10
  267. package/dist/transform/write/relationships.d.ts.map +0 -1
  268. package/dist/transform/write/relationships.js +0 -23
  269. package/dist/transform/write/relationships.js.map +0 -1
  270. package/dist/transform/write/selects.d.ts +0 -8
  271. package/dist/transform/write/selects.d.ts.map +0 -1
  272. package/dist/transform/write/selects.js +0 -20
  273. package/dist/transform/write/selects.js.map +0 -1
  274. package/dist/transform/write/texts.d.ts +0 -8
  275. package/dist/transform/write/texts.d.ts.map +0 -1
  276. package/dist/transform/write/texts.js +0 -11
  277. package/dist/transform/write/texts.js.map +0 -1
  278. package/dist/transform/write/traverseFields.d.ts +0 -50
  279. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  280. package/dist/transform/write/traverseFields.js +0 -445
  281. package/dist/transform/write/traverseFields.js.map +0 -1
  282. package/dist/transform/write/types.d.ts +0 -43
  283. package/dist/transform/write/types.d.ts.map +0 -1
  284. package/dist/transform/write/types.js +0 -3
  285. package/dist/transform/write/types.js.map +0 -1
  286. package/dist/update.d.ts +0 -3
  287. package/dist/update.d.ts.map +0 -1
  288. package/dist/update.js +0 -54
  289. package/dist/update.js.map +0 -1
  290. package/dist/updateGlobal.d.ts +0 -5
  291. package/dist/updateGlobal.d.ts.map +0 -1
  292. package/dist/updateGlobal.js +0 -25
  293. package/dist/updateGlobal.js.map +0 -1
  294. package/dist/updateGlobalVersion.d.ts +0 -5
  295. package/dist/updateGlobalVersion.d.ts.map +0 -1
  296. package/dist/updateGlobalVersion.js +0 -36
  297. package/dist/updateGlobalVersion.js.map +0 -1
  298. package/dist/updateVersion.d.ts +0 -5
  299. package/dist/updateVersion.d.ts.map +0 -1
  300. package/dist/updateVersion.js +0 -36
  301. package/dist/updateVersion.js.map +0 -1
  302. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  303. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  304. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  305. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  306. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  307. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  308. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  309. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  310. package/dist/upsertRow/index.d.ts +0 -4
  311. package/dist/upsertRow/index.d.ts.map +0 -1
  312. package/dist/upsertRow/index.js +0 -279
  313. package/dist/upsertRow/index.js.map +0 -1
  314. package/dist/upsertRow/insertArrays.d.ts +0 -13
  315. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  316. package/dist/upsertRow/insertArrays.js +0 -68
  317. package/dist/upsertRow/insertArrays.js.map +0 -1
  318. package/dist/upsertRow/types.d.ts +0 -32
  319. package/dist/upsertRow/types.d.ts.map +0 -1
  320. package/dist/upsertRow/types.js +0 -3
  321. package/dist/upsertRow/types.js.map +0 -1
  322. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  323. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  324. package/dist/utilities/appendPrefixToKeys.js +0 -6
  325. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  326. package/dist/utilities/createBlocksMap.d.ts +0 -5
  327. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  328. package/dist/utilities/createBlocksMap.js +0 -29
  329. package/dist/utilities/createBlocksMap.js.map +0 -1
  330. package/dist/utilities/createMigrationTable.d.ts +0 -3
  331. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  332. package/dist/utilities/createMigrationTable.js +0 -13
  333. package/dist/utilities/createMigrationTable.js.map +0 -1
  334. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  335. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  336. package/dist/utilities/createRelationshipMap.js +0 -19
  337. package/dist/utilities/createRelationshipMap.js.map +0 -1
  338. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  339. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  340. package/dist/utilities/hasLocalesTable.js +0 -11
  341. package/dist/utilities/hasLocalesTable.js.map +0 -1
  342. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  343. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  344. package/dist/utilities/isArrayOfRows.js +0 -5
  345. package/dist/utilities/isArrayOfRows.js.map +0 -1
  346. package/dist/utilities/migrationTableExists.d.ts +0 -3
  347. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  348. package/dist/utilities/migrationTableExists.js +0 -9
  349. package/dist/utilities/migrationTableExists.js.map +0 -1
  350. package/dist/utilities/parseError.d.ts +0 -5
  351. package/dist/utilities/parseError.d.ts.map +0 -1
  352. package/dist/utilities/parseError.js +0 -17
  353. package/dist/utilities/parseError.js.map +0 -1
  354. package/dist/utilities/pushDevSchema.d.ts +0 -9
  355. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  356. package/dist/utilities/pushDevSchema.js +0 -58
  357. package/dist/utilities/pushDevSchema.js.map +0 -1
@@ -1,24 +0,0 @@
1
- import { numeric, serial, uuid, varchar } from 'drizzle-orm/pg-core';
2
- import { fieldAffectsData } from 'payload/types';
3
- import { flattenTopLevelFields } from 'payload/utilities';
4
- export const setColumnID = ({ adapter, columns, fields })=>{
5
- const idField = flattenTopLevelFields(fields).find((field)=>fieldAffectsData(field) && field.name === 'id');
6
- if (idField) {
7
- if (idField.type === 'number') {
8
- columns.id = numeric('id').primaryKey();
9
- return 'numeric';
10
- }
11
- if (idField.type === 'text') {
12
- columns.id = varchar('id').primaryKey();
13
- return 'varchar';
14
- }
15
- }
16
- if (adapter.idType === 'uuid') {
17
- columns.id = uuid('id').defaultRandom().primaryKey();
18
- return 'uuid';
19
- }
20
- columns.id = serial('id').primaryKey();
21
- return 'integer';
22
- };
23
-
24
- //# sourceMappingURL=setColumnID.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/schema/setColumnID.ts"],"sourcesContent":["import type { PgColumnBuilder } from 'drizzle-orm/pg-core'\n\nimport { numeric, serial, uuid, varchar } from 'drizzle-orm/pg-core'\nimport { type Field, fieldAffectsData } from 'payload/types'\nimport { flattenTopLevelFields } from 'payload/utilities'\n\nimport type { IDType, PostgresAdapter } from '../types.js'\n\ntype Args = { adapter: PostgresAdapter; columns: Record<string, PgColumnBuilder>; fields: Field[] }\nexport const setColumnID = ({ adapter, columns, fields }: Args): IDType => {\n const idField = flattenTopLevelFields(fields).find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n if (idField) {\n if (idField.type === 'number') {\n columns.id = numeric('id').primaryKey()\n return 'numeric'\n }\n\n if (idField.type === 'text') {\n columns.id = varchar('id').primaryKey()\n return 'varchar'\n }\n }\n\n if (adapter.idType === 'uuid') {\n columns.id = uuid('id').defaultRandom().primaryKey()\n return 'uuid'\n }\n\n columns.id = serial('id').primaryKey()\n return 'integer'\n}\n"],"names":["numeric","serial","uuid","varchar","fieldAffectsData","flattenTopLevelFields","setColumnID","adapter","columns","fields","idField","find","field","name","type","id","primaryKey","idType","defaultRandom"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,OAAO,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,QAAQ,sBAAqB;AACpE,SAAqBC,gBAAgB,QAAQ,gBAAe;AAC5D,SAASC,qBAAqB,QAAQ,oBAAmB;AAKzD,OAAO,MAAMC,cAAc,CAAC,EAAEC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAQ;IAC5D,MAAMC,UAAUL,sBAAsBI,QAAQE,IAAI,CAChD,CAACC,QAAUR,iBAAiBQ,UAAUA,MAAMC,IAAI,KAAK;IAEvD,IAAIH,SAAS;QACX,IAAIA,QAAQI,IAAI,KAAK,UAAU;YAC7BN,QAAQO,EAAE,GAAGf,QAAQ,MAAMgB,UAAU;YACrC,OAAO;QACT;QAEA,IAAIN,QAAQI,IAAI,KAAK,QAAQ;YAC3BN,QAAQO,EAAE,GAAGZ,QAAQ,MAAMa,UAAU;YACrC,OAAO;QACT;IACF;IAEA,IAAIT,QAAQU,MAAM,KAAK,QAAQ;QAC7BT,QAAQO,EAAE,GAAGb,KAAK,MAAMgB,aAAa,GAAGF,UAAU;QAClD,OAAO;IACT;IAEAR,QAAQO,EAAE,GAAGd,OAAO,MAAMe,UAAU;IACpC,OAAO;AACT,EAAC"}
@@ -1,36 +0,0 @@
1
- import type { IndexBuilder, PgColumnBuilder } from 'drizzle-orm/pg-core';
2
- import type { Field, TabAsField } from 'payload/types';
3
- import type { GenericColumns, PostgresAdapter } from '../types.js';
4
- import type { RelationMap } from './build.js';
5
- type Args = {
6
- adapter: PostgresAdapter;
7
- columnPrefix?: string;
8
- columns: Record<string, PgColumnBuilder>;
9
- disableNotNull: boolean;
10
- disableUnique?: boolean;
11
- fieldPrefix?: string;
12
- fields: (Field | TabAsField)[];
13
- forceLocalized?: boolean;
14
- indexes: Record<string, (cols: GenericColumns) => IndexBuilder>;
15
- localesColumns: Record<string, PgColumnBuilder>;
16
- localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>;
17
- newTableName: string;
18
- parentTableName: string;
19
- relationsToBuild: RelationMap;
20
- relationships: Set<string>;
21
- rootRelationsToBuild?: RelationMap;
22
- rootTableIDColType: string;
23
- rootTableName: string;
24
- versions: boolean;
25
- };
26
- type Result = {
27
- hasLocalizedField: boolean;
28
- hasLocalizedManyNumberField: boolean;
29
- hasLocalizedManyTextField: boolean;
30
- hasLocalizedRelationshipField: boolean;
31
- hasManyNumberField: 'index' | boolean;
32
- hasManyTextField: 'index' | boolean;
33
- };
34
- export declare const traverseFields: ({ adapter, columnPrefix, columns, disableNotNull, disableUnique, fieldPrefix, fields, forceLocalized, indexes, localesColumns, localesIndexes, newTableName, parentTableName, relationsToBuild, relationships, rootRelationsToBuild, rootTableIDColType, rootTableName, versions, }: Args) => Result;
35
- export {};
36
- //# sourceMappingURL=traverseFields.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../src/schema/traverseFields.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAsBtD,OAAO,KAAK,EAAE,cAAc,EAAU,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,YAAY,CAAA;AAU9D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACxC,cAAc,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,YAAY,CAAC,CAAA;IAC/D,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC/C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,YAAY,CAAC,CAAA;IACtE,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,WAAW,CAAA;IAC7B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,oBAAoB,CAAC,EAAE,WAAW,CAAA;IAClC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,iBAAiB,EAAE,OAAO,CAAA;IAC1B,2BAA2B,EAAE,OAAO,CAAA;IACpC,yBAAyB,EAAE,OAAO,CAAA;IAClC,6BAA6B,EAAE,OAAO,CAAA;IACtC,kBAAkB,EAAE,OAAO,GAAG,OAAO,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,wRAoBxB,IAAI,KAAG,MA4rBT,CAAA"}