@payloadcms/db-postgres 3.0.0-canary.6041f49 → 3.0.0-canary.690108d

Sign up to get free protection for your applications and to get access to all the features.
Files changed (369) 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 +22 -13
  5. package/dist/connect.js.map +1 -1
  6. package/dist/exports/migration-utils.d.ts +2 -0
  7. package/dist/exports/migration-utils.d.ts.map +1 -0
  8. package/dist/exports/migration-utils.js +3 -0
  9. package/dist/exports/migration-utils.js.map +1 -0
  10. package/dist/index.d.ts +1 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +40 -67
  13. package/dist/index.js.map +1 -1
  14. package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
  15. package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
  16. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
  17. package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
  18. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
  19. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
  20. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
  21. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
  22. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
  23. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
  24. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +191 -0
  25. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
  26. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
  27. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
  28. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
  29. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
  30. package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
  31. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
  32. package/dist/predefinedMigrations/v2-v3/index.js +211 -0
  33. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
  34. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
  35. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
  36. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +57 -0
  37. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
  38. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
  39. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
  40. package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
  41. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
  42. package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
  43. package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
  44. package/dist/predefinedMigrations/v2-v3/types.js +6 -0
  45. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
  46. package/dist/types.d.ts +42 -77
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/types.js.map +1 -1
  49. package/package.json +24 -15
  50. package/dist/count.d.ts +0 -3
  51. package/dist/count.d.ts.map +0 -1
  52. package/dist/count.js +0 -50
  53. package/dist/count.js.map +0 -1
  54. package/dist/create.d.ts +0 -3
  55. package/dist/create.d.ts.map +0 -1
  56. package/dist/create.js +0 -19
  57. package/dist/create.js.map +0 -1
  58. package/dist/createGlobal.d.ts +0 -5
  59. package/dist/createGlobal.d.ts.map +0 -1
  60. package/dist/createGlobal.js +0 -19
  61. package/dist/createGlobal.js.map +0 -1
  62. package/dist/createGlobalVersion.d.ts +0 -6
  63. package/dist/createGlobalVersion.d.ts.map +0 -1
  64. package/dist/createGlobalVersion.js +0 -33
  65. package/dist/createGlobalVersion.js.map +0 -1
  66. package/dist/createMigration.d.ts +0 -3
  67. package/dist/createMigration.d.ts.map +0 -1
  68. package/dist/createMigration.js +0 -81
  69. package/dist/createMigration.js.map +0 -1
  70. package/dist/createVersion.d.ts +0 -5
  71. package/dist/createVersion.d.ts.map +0 -1
  72. package/dist/createVersion.js +0 -44
  73. package/dist/createVersion.js.map +0 -1
  74. package/dist/deleteMany.d.ts +0 -3
  75. package/dist/deleteMany.d.ts.map +0 -1
  76. package/dist/deleteMany.js +0 -28
  77. package/dist/deleteMany.js.map +0 -1
  78. package/dist/deleteOne.d.ts +0 -3
  79. package/dist/deleteOne.d.ts.map +0 -1
  80. package/dist/deleteOne.js +0 -59
  81. package/dist/deleteOne.js.map +0 -1
  82. package/dist/deleteVersions.d.ts +0 -3
  83. package/dist/deleteVersions.d.ts.map +0 -1
  84. package/dist/deleteVersions.js +0 -31
  85. package/dist/deleteVersions.js.map +0 -1
  86. package/dist/destroy.d.ts +0 -3
  87. package/dist/destroy.d.ts.map +0 -1
  88. package/dist/destroy.js +0 -11
  89. package/dist/destroy.js.map +0 -1
  90. package/dist/find/buildFindManyArgs.d.ts +0 -13
  91. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  92. package/dist/find/buildFindManyArgs.js +0 -64
  93. package/dist/find/buildFindManyArgs.js.map +0 -1
  94. package/dist/find/chainMethods.d.ts +0 -16
  95. package/dist/find/chainMethods.d.ts.map +0 -1
  96. package/dist/find/chainMethods.js +0 -12
  97. package/dist/find/chainMethods.js.map +0 -1
  98. package/dist/find/findMany.d.ts +0 -22
  99. package/dist/find/findMany.d.ts.map +0 -1
  100. package/dist/find/findMany.js +0 -163
  101. package/dist/find/findMany.js.map +0 -1
  102. package/dist/find/traverseFields.d.ts +0 -16
  103. package/dist/find/traverseFields.d.ts.map +0 -1
  104. package/dist/find/traverseFields.js +0 -138
  105. package/dist/find/traverseFields.js.map +0 -1
  106. package/dist/find.d.ts +0 -3
  107. package/dist/find.d.ts.map +0 -1
  108. package/dist/find.js +0 -21
  109. package/dist/find.js.map +0 -1
  110. package/dist/findGlobal.d.ts +0 -3
  111. package/dist/findGlobal.d.ts.map +0 -1
  112. package/dist/findGlobal.js +0 -23
  113. package/dist/findGlobal.js.map +0 -1
  114. package/dist/findGlobalVersions.d.ts +0 -3
  115. package/dist/findGlobalVersions.d.ts.map +0 -1
  116. package/dist/findGlobalVersions.js +0 -24
  117. package/dist/findGlobalVersions.js.map +0 -1
  118. package/dist/findOne.d.ts +0 -5
  119. package/dist/findOne.d.ts.map +0 -1
  120. package/dist/findOne.js +0 -21
  121. package/dist/findOne.js.map +0 -1
  122. package/dist/findVersions.d.ts +0 -3
  123. package/dist/findVersions.d.ts.map +0 -1
  124. package/dist/findVersions.js +0 -24
  125. package/dist/findVersions.js.map +0 -1
  126. package/dist/init.d.ts +0 -3
  127. package/dist/init.d.ts.map +0 -1
  128. package/dist/init.js +0 -96
  129. package/dist/init.js.map +0 -1
  130. package/dist/migrate.d.ts +0 -3
  131. package/dist/migrate.d.ts.map +0 -1
  132. package/dist/migrate.js +0 -99
  133. package/dist/migrate.js.map +0 -1
  134. package/dist/migrateDown.d.ts +0 -3
  135. package/dist/migrateDown.d.ts.map +0 -1
  136. package/dist/migrateDown.js +0 -63
  137. package/dist/migrateDown.js.map +0 -1
  138. package/dist/migrateFresh.d.ts +0 -8
  139. package/dist/migrateFresh.d.ts.map +0 -1
  140. package/dist/migrateFresh.js +0 -72
  141. package/dist/migrateFresh.js.map +0 -1
  142. package/dist/migrateRefresh.d.ts +0 -6
  143. package/dist/migrateRefresh.d.ts.map +0 -1
  144. package/dist/migrateRefresh.js +0 -102
  145. package/dist/migrateRefresh.js.map +0 -1
  146. package/dist/migrateReset.d.ts +0 -6
  147. package/dist/migrateReset.d.ts.map +0 -1
  148. package/dist/migrateReset.js +0 -82
  149. package/dist/migrateReset.js.map +0 -1
  150. package/dist/migrateStatus.d.ts +0 -3
  151. package/dist/migrateStatus.d.ts.map +0 -1
  152. package/dist/migrateStatus.js +0 -44
  153. package/dist/migrateStatus.js.map +0 -1
  154. package/dist/queries/buildAndOrConditions.d.ts +0 -17
  155. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  156. package/dist/queries/buildAndOrConditions.js +0 -29
  157. package/dist/queries/buildAndOrConditions.js.map +0 -1
  158. package/dist/queries/buildQuery.d.ts +0 -31
  159. package/dist/queries/buildQuery.d.ts.map +0 -1
  160. package/dist/queries/buildQuery.js +0 -76
  161. package/dist/queries/buildQuery.js.map +0 -1
  162. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
  163. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  164. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
  165. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  166. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
  167. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  168. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
  169. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  170. package/dist/queries/createJSONQuery/index.d.ts +0 -10
  171. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  172. package/dist/queries/createJSONQuery/index.js +0 -54
  173. package/dist/queries/createJSONQuery/index.js.map +0 -1
  174. package/dist/queries/getTableColumnFromPath.d.ts +0 -51
  175. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  176. package/dist/queries/getTableColumnFromPath.js +0 -445
  177. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  178. package/dist/queries/operatorMap.d.ts +0 -18
  179. package/dist/queries/operatorMap.d.ts.map +0 -1
  180. package/dist/queries/operatorMap.js +0 -24
  181. package/dist/queries/operatorMap.js.map +0 -1
  182. package/dist/queries/parseParams.d.ts +0 -17
  183. package/dist/queries/parseParams.d.ts.map +0 -1
  184. package/dist/queries/parseParams.js +0 -182
  185. package/dist/queries/parseParams.js.map +0 -1
  186. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  187. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  188. package/dist/queries/sanitizeQueryValue.js +0 -90
  189. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  190. package/dist/queries/selectDistinct.d.ts +0 -23
  191. package/dist/queries/selectDistinct.d.ts.map +0 -1
  192. package/dist/queries/selectDistinct.js +0 -41
  193. package/dist/queries/selectDistinct.js.map +0 -1
  194. package/dist/queryDrafts.d.ts +0 -3
  195. package/dist/queryDrafts.d.ts.map +0 -1
  196. package/dist/queryDrafts.js +0 -41
  197. package/dist/queryDrafts.js.map +0 -1
  198. package/dist/schema/build.d.ts +0 -30
  199. package/dist/schema/build.d.ts.map +0 -1
  200. package/dist/schema/build.js +0 -320
  201. package/dist/schema/build.js.map +0 -1
  202. package/dist/schema/createIndex.d.ts +0 -12
  203. package/dist/schema/createIndex.d.ts.map +0 -1
  204. package/dist/schema/createIndex.js +0 -18
  205. package/dist/schema/createIndex.js.map +0 -1
  206. package/dist/schema/createTableName.d.ts +0 -30
  207. package/dist/schema/createTableName.d.ts.map +0 -1
  208. package/dist/schema/createTableName.js +0 -31
  209. package/dist/schema/createTableName.js.map +0 -1
  210. package/dist/schema/idToUUID.d.ts +0 -3
  211. package/dist/schema/idToUUID.d.ts.map +0 -1
  212. package/dist/schema/idToUUID.js +0 -11
  213. package/dist/schema/idToUUID.js.map +0 -1
  214. package/dist/schema/parentIDColumnMap.d.ts +0 -4
  215. package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
  216. package/dist/schema/parentIDColumnMap.js +0 -9
  217. package/dist/schema/parentIDColumnMap.js.map +0 -1
  218. package/dist/schema/setColumnID.d.ts +0 -11
  219. package/dist/schema/setColumnID.d.ts.map +0 -1
  220. package/dist/schema/setColumnID.js +0 -24
  221. package/dist/schema/setColumnID.js.map +0 -1
  222. package/dist/schema/traverseFields.d.ts +0 -38
  223. package/dist/schema/traverseFields.d.ts.map +0 -1
  224. package/dist/schema/traverseFields.js +0 -551
  225. package/dist/schema/traverseFields.js.map +0 -1
  226. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
  227. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  228. package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
  229. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  230. package/dist/transactions/beginTransaction.d.ts +0 -3
  231. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  232. package/dist/transactions/beginTransaction.js +0 -47
  233. package/dist/transactions/beginTransaction.js.map +0 -1
  234. package/dist/transactions/commitTransaction.d.ts +0 -3
  235. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  236. package/dist/transactions/commitTransaction.js +0 -14
  237. package/dist/transactions/commitTransaction.js.map +0 -1
  238. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  239. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  240. package/dist/transactions/rollbackTransaction.js +0 -13
  241. package/dist/transactions/rollbackTransaction.js.map +0 -1
  242. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  243. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  244. package/dist/transform/read/hasManyNumber.js +0 -10
  245. package/dist/transform/read/hasManyNumber.js.map +0 -1
  246. package/dist/transform/read/hasManyText.d.ts +0 -10
  247. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  248. package/dist/transform/read/hasManyText.js +0 -10
  249. package/dist/transform/read/hasManyText.js.map +0 -1
  250. package/dist/transform/read/index.d.ts +0 -12
  251. package/dist/transform/read/index.d.ts.map +0 -1
  252. package/dist/transform/read/index.js +0 -43
  253. package/dist/transform/read/index.js.map +0 -1
  254. package/dist/transform/read/relationship.d.ts +0 -10
  255. package/dist/transform/read/relationship.d.ts.map +0 -1
  256. package/dist/transform/read/relationship.js +0 -64
  257. package/dist/transform/read/relationship.js.map +0 -1
  258. package/dist/transform/read/traverseFields.d.ts +0 -52
  259. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  260. package/dist/transform/read/traverseFields.js +0 -421
  261. package/dist/transform/read/traverseFields.js.map +0 -1
  262. package/dist/transform/write/array.d.ts +0 -26
  263. package/dist/transform/write/array.d.ts.map +0 -1
  264. package/dist/transform/write/array.js +0 -58
  265. package/dist/transform/write/array.js.map +0 -1
  266. package/dist/transform/write/blocks.d.ts +0 -25
  267. package/dist/transform/write/blocks.d.ts.map +0 -1
  268. package/dist/transform/write/blocks.js +0 -54
  269. package/dist/transform/write/blocks.js.map +0 -1
  270. package/dist/transform/write/index.d.ts +0 -13
  271. package/dist/transform/write/index.d.ts.map +0 -1
  272. package/dist/transform/write/index.js +0 -41
  273. package/dist/transform/write/index.js.map +0 -1
  274. package/dist/transform/write/numbers.d.ts +0 -8
  275. package/dist/transform/write/numbers.d.ts.map +0 -1
  276. package/dist/transform/write/numbers.js +0 -11
  277. package/dist/transform/write/numbers.js.map +0 -1
  278. package/dist/transform/write/relationships.d.ts +0 -10
  279. package/dist/transform/write/relationships.d.ts.map +0 -1
  280. package/dist/transform/write/relationships.js +0 -23
  281. package/dist/transform/write/relationships.js.map +0 -1
  282. package/dist/transform/write/selects.d.ts +0 -8
  283. package/dist/transform/write/selects.d.ts.map +0 -1
  284. package/dist/transform/write/selects.js +0 -20
  285. package/dist/transform/write/selects.js.map +0 -1
  286. package/dist/transform/write/texts.d.ts +0 -8
  287. package/dist/transform/write/texts.d.ts.map +0 -1
  288. package/dist/transform/write/texts.js +0 -11
  289. package/dist/transform/write/texts.js.map +0 -1
  290. package/dist/transform/write/traverseFields.d.ts +0 -50
  291. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  292. package/dist/transform/write/traverseFields.js +0 -428
  293. package/dist/transform/write/traverseFields.js.map +0 -1
  294. package/dist/transform/write/types.d.ts +0 -43
  295. package/dist/transform/write/types.d.ts.map +0 -1
  296. package/dist/transform/write/types.js +0 -3
  297. package/dist/transform/write/types.js.map +0 -1
  298. package/dist/update.d.ts +0 -3
  299. package/dist/update.d.ts.map +0 -1
  300. package/dist/update.js +0 -55
  301. package/dist/update.js.map +0 -1
  302. package/dist/updateGlobal.d.ts +0 -5
  303. package/dist/updateGlobal.d.ts.map +0 -1
  304. package/dist/updateGlobal.js +0 -25
  305. package/dist/updateGlobal.js.map +0 -1
  306. package/dist/updateGlobalVersion.d.ts +0 -5
  307. package/dist/updateGlobalVersion.d.ts.map +0 -1
  308. package/dist/updateGlobalVersion.js +0 -36
  309. package/dist/updateGlobalVersion.js.map +0 -1
  310. package/dist/updateVersion.d.ts +0 -5
  311. package/dist/updateVersion.d.ts.map +0 -1
  312. package/dist/updateVersion.js +0 -36
  313. package/dist/updateVersion.js.map +0 -1
  314. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  315. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  316. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  317. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  318. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  319. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  320. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  321. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  322. package/dist/upsertRow/index.d.ts +0 -4
  323. package/dist/upsertRow/index.d.ts.map +0 -1
  324. package/dist/upsertRow/index.js +0 -277
  325. package/dist/upsertRow/index.js.map +0 -1
  326. package/dist/upsertRow/insertArrays.d.ts +0 -13
  327. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  328. package/dist/upsertRow/insertArrays.js +0 -68
  329. package/dist/upsertRow/insertArrays.js.map +0 -1
  330. package/dist/upsertRow/types.d.ts +0 -27
  331. package/dist/upsertRow/types.d.ts.map +0 -1
  332. package/dist/upsertRow/types.js +0 -3
  333. package/dist/upsertRow/types.js.map +0 -1
  334. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  335. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  336. package/dist/utilities/appendPrefixToKeys.js +0 -6
  337. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  338. package/dist/utilities/createBlocksMap.d.ts +0 -5
  339. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  340. package/dist/utilities/createBlocksMap.js +0 -29
  341. package/dist/utilities/createBlocksMap.js.map +0 -1
  342. package/dist/utilities/createMigrationTable.d.ts +0 -3
  343. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  344. package/dist/utilities/createMigrationTable.js +0 -13
  345. package/dist/utilities/createMigrationTable.js.map +0 -1
  346. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  347. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  348. package/dist/utilities/createRelationshipMap.js +0 -19
  349. package/dist/utilities/createRelationshipMap.js.map +0 -1
  350. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  351. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  352. package/dist/utilities/hasLocalesTable.js +0 -11
  353. package/dist/utilities/hasLocalesTable.js.map +0 -1
  354. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  355. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  356. package/dist/utilities/isArrayOfRows.js +0 -5
  357. package/dist/utilities/isArrayOfRows.js.map +0 -1
  358. package/dist/utilities/migrationTableExists.d.ts +0 -3
  359. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  360. package/dist/utilities/migrationTableExists.js +0 -9
  361. package/dist/utilities/migrationTableExists.js.map +0 -1
  362. package/dist/utilities/parseError.d.ts +0 -5
  363. package/dist/utilities/parseError.d.ts.map +0 -1
  364. package/dist/utilities/parseError.js +0 -17
  365. package/dist/utilities/parseError.js.map +0 -1
  366. package/dist/utilities/pushDevSchema.d.ts +0 -9
  367. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  368. package/dist/utilities/pushDevSchema.js +0 -58
  369. package/dist/utilities/pushDevSchema.js.map +0 -1
@@ -1,320 +0,0 @@
1
- /* eslint-disable no-param-reassign */ import { relations } from 'drizzle-orm';
2
- import { foreignKey, index, integer, numeric, serial, timestamp, unique, varchar } from 'drizzle-orm/pg-core';
3
- import toSnakeCase from 'to-snake-case';
4
- import { createTableName } from './createTableName.js';
5
- import { parentIDColumnMap } from './parentIDColumnMap.js';
6
- import { setColumnID } from './setColumnID.js';
7
- import { traverseFields } from './traverseFields.js';
8
- export const buildTable = ({ adapter, baseColumns = {}, baseExtraConfig = {}, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique = false, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, versions })=>{
9
- const rootTableName = incomingRootTableName || tableName;
10
- const columns = baseColumns;
11
- const indexes = {};
12
- const localesColumns = {};
13
- const localesIndexes = {};
14
- let localesTable;
15
- let textsTable;
16
- let numbersTable;
17
- // Relationships to the base collection
18
- const relationships = rootRelationships || new Set();
19
- let relationshipsTable;
20
- // Drizzle relations
21
- const relationsToBuild = new Map();
22
- const idColType = setColumnID({
23
- adapter,
24
- columns,
25
- fields
26
- });
27
- const { hasLocalizedField, hasLocalizedManyNumberField, hasLocalizedManyTextField, hasLocalizedRelationshipField, hasManyNumberField, hasManyTextField } = traverseFields({
28
- adapter,
29
- buildNumbers,
30
- buildRelationships,
31
- buildTexts,
32
- columns,
33
- disableNotNull,
34
- disableUnique,
35
- fields,
36
- indexes,
37
- localesColumns,
38
- localesIndexes,
39
- newTableName: tableName,
40
- parentTableName: tableName,
41
- relationsToBuild,
42
- relationships,
43
- rootRelationsToBuild: rootRelationsToBuild || relationsToBuild,
44
- rootTableIDColType: rootTableIDColType || idColType,
45
- rootTableName,
46
- versions
47
- });
48
- if (timestamps) {
49
- columns.createdAt = timestamp('created_at', {
50
- mode: 'string',
51
- precision: 3,
52
- withTimezone: true
53
- }).defaultNow().notNull();
54
- columns.updatedAt = timestamp('updated_at', {
55
- mode: 'string',
56
- precision: 3,
57
- withTimezone: true
58
- }).defaultNow().notNull();
59
- }
60
- const table = adapter.pgSchema.table(tableName, columns, (cols)=>{
61
- const extraConfig = Object.entries(baseExtraConfig).reduce((config, [key, func])=>{
62
- config[key] = func(cols);
63
- return config;
64
- }, {});
65
- const result = Object.entries(indexes).reduce((acc, [colName, func])=>{
66
- acc[colName] = func(cols);
67
- return acc;
68
- }, extraConfig);
69
- return result;
70
- });
71
- adapter.tables[tableName] = table;
72
- if (hasLocalizedField) {
73
- const localeTableName = `${tableName}${adapter.localesSuffix}`;
74
- localesColumns.id = serial('id').primaryKey();
75
- localesColumns._locale = adapter.enums.enum__locales('_locale').notNull();
76
- localesColumns._parentID = parentIDColumnMap[idColType]('_parent_id').notNull();
77
- localesTable = adapter.pgSchema.table(localeTableName, localesColumns, (cols)=>{
78
- return Object.entries(localesIndexes).reduce((acc, [colName, func])=>{
79
- acc[colName] = func(cols);
80
- return acc;
81
- }, {
82
- _localeParent: unique(`${localeTableName}_locale_parent_id_unique`).on(cols._locale, cols._parentID),
83
- _parentIdFk: foreignKey({
84
- name: `${localeTableName}_parent_id_fk`,
85
- columns: [
86
- cols._parentID
87
- ],
88
- foreignColumns: [
89
- table.id
90
- ]
91
- }).onDelete('cascade')
92
- });
93
- });
94
- adapter.tables[localeTableName] = localesTable;
95
- const localesTableRelations = relations(localesTable, ({ one })=>({
96
- _parentID: one(table, {
97
- fields: [
98
- localesTable._parentID
99
- ],
100
- references: [
101
- table.id
102
- ]
103
- })
104
- }));
105
- adapter.relations[`relations_${localeTableName}`] = localesTableRelations;
106
- }
107
- if (hasManyTextField && buildTexts) {
108
- const textsTableName = `${rootTableName}_texts`;
109
- const columns = {
110
- id: serial('id').primaryKey(),
111
- order: integer('order').notNull(),
112
- parent: parentIDColumnMap[idColType]('parent_id').notNull(),
113
- path: varchar('path').notNull(),
114
- text: varchar('text')
115
- };
116
- if (hasLocalizedManyTextField) {
117
- columns.locale = adapter.enums.enum__locales('locale');
118
- }
119
- textsTable = adapter.pgSchema.table(textsTableName, columns, (cols)=>{
120
- const config = {
121
- orderParentIdx: index(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent),
122
- parentFk: foreignKey({
123
- name: `${textsTableName}_parent_fk`,
124
- columns: [
125
- cols.parent
126
- ],
127
- foreignColumns: [
128
- table.id
129
- ]
130
- }).onDelete('cascade')
131
- };
132
- if (hasManyTextField === 'index') {
133
- config.text_idx = index(`${textsTableName}_text_idx`).on(cols.text);
134
- }
135
- if (hasLocalizedManyTextField) {
136
- config.localeParent = index(`${textsTableName}_locale_parent`).on(cols.locale, cols.parent);
137
- }
138
- return config;
139
- });
140
- adapter.tables[textsTableName] = textsTable;
141
- const textsTableRelations = relations(textsTable, ({ one })=>({
142
- parent: one(table, {
143
- fields: [
144
- textsTable.parent
145
- ],
146
- references: [
147
- table.id
148
- ]
149
- })
150
- }));
151
- adapter.relations[`relations_${textsTableName}`] = textsTableRelations;
152
- }
153
- if (hasManyNumberField && buildNumbers) {
154
- const numbersTableName = `${rootTableName}_numbers`;
155
- const columns = {
156
- id: serial('id').primaryKey(),
157
- number: numeric('number'),
158
- order: integer('order').notNull(),
159
- parent: parentIDColumnMap[idColType]('parent_id').notNull(),
160
- path: varchar('path').notNull()
161
- };
162
- if (hasLocalizedManyNumberField) {
163
- columns.locale = adapter.enums.enum__locales('locale');
164
- }
165
- numbersTable = adapter.pgSchema.table(numbersTableName, columns, (cols)=>{
166
- const config = {
167
- orderParentIdx: index(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent),
168
- parentFk: foreignKey({
169
- name: `${numbersTableName}_parent_fk`,
170
- columns: [
171
- cols.parent
172
- ],
173
- foreignColumns: [
174
- table.id
175
- ]
176
- }).onDelete('cascade')
177
- };
178
- if (hasManyNumberField === 'index') {
179
- config.numberIdx = index(`${numbersTableName}_number_idx`).on(cols.number);
180
- }
181
- if (hasLocalizedManyNumberField) {
182
- config.localeParent = index(`${numbersTableName}_locale_parent`).on(cols.locale, cols.parent);
183
- }
184
- return config;
185
- });
186
- adapter.tables[numbersTableName] = numbersTable;
187
- const numbersTableRelations = relations(numbersTable, ({ one })=>({
188
- parent: one(table, {
189
- fields: [
190
- numbersTable.parent
191
- ],
192
- references: [
193
- table.id
194
- ]
195
- })
196
- }));
197
- adapter.relations[`relations_${numbersTableName}`] = numbersTableRelations;
198
- }
199
- if (buildRelationships) {
200
- if (relationships.size) {
201
- const relationshipColumns = {
202
- id: serial('id').primaryKey(),
203
- order: integer('order'),
204
- parent: parentIDColumnMap[idColType]('parent_id').notNull(),
205
- path: varchar('path').notNull()
206
- };
207
- if (hasLocalizedRelationshipField) {
208
- relationshipColumns.locale = adapter.enums.enum__locales('locale');
209
- }
210
- const relationExtraConfig = {};
211
- const relationshipsTableName = `${tableName}${adapter.relationshipsSuffix}`;
212
- relationships.forEach((relationTo)=>{
213
- const relationshipConfig = adapter.payload.collections[relationTo].config;
214
- const formattedRelationTo = createTableName({
215
- adapter,
216
- config: relationshipConfig,
217
- throwValidationError: true
218
- });
219
- let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer';
220
- const relatedCollectionCustomIDType = adapter.payload.collections[relationshipConfig.slug]?.customIDType;
221
- if (relatedCollectionCustomIDType === 'number') colType = 'numeric';
222
- if (relatedCollectionCustomIDType === 'text') colType = 'varchar';
223
- relationshipColumns[`${relationTo}ID`] = parentIDColumnMap[colType](`${formattedRelationTo}_id`);
224
- relationExtraConfig[`${relationTo}IdFk`] = (cols)=>foreignKey({
225
- name: `${relationshipsTableName}_${toSnakeCase(relationTo)}_fk`,
226
- columns: [
227
- cols[`${relationTo}ID`]
228
- ],
229
- foreignColumns: [
230
- adapter.tables[formattedRelationTo].id
231
- ]
232
- }).onDelete('cascade');
233
- });
234
- relationshipsTable = adapter.pgSchema.table(relationshipsTableName, relationshipColumns, (cols)=>{
235
- const result = Object.entries(relationExtraConfig).reduce((config, [key, func])=>{
236
- config[key] = func(cols);
237
- return config;
238
- }, {
239
- order: index(`${relationshipsTableName}_order_idx`).on(cols.order),
240
- parentFk: foreignKey({
241
- name: `${relationshipsTableName}_parent_fk`,
242
- columns: [
243
- cols.parent
244
- ],
245
- foreignColumns: [
246
- table.id
247
- ]
248
- }).onDelete('cascade'),
249
- parentIdx: index(`${relationshipsTableName}_parent_idx`).on(cols.parent),
250
- pathIdx: index(`${relationshipsTableName}_path_idx`).on(cols.path)
251
- });
252
- if (hasLocalizedRelationshipField) {
253
- result.localeIdx = index(`${relationshipsTableName}_locale_idx`).on(cols.locale);
254
- }
255
- return result;
256
- });
257
- adapter.tables[relationshipsTableName] = relationshipsTable;
258
- const relationshipsTableRelations = relations(relationshipsTable, ({ one })=>{
259
- const result = {
260
- parent: one(table, {
261
- fields: [
262
- relationshipsTable.parent
263
- ],
264
- references: [
265
- table.id
266
- ],
267
- relationName: '_rels'
268
- })
269
- };
270
- relationships.forEach((relationTo)=>{
271
- const relatedTableName = createTableName({
272
- adapter,
273
- config: adapter.payload.collections[relationTo].config,
274
- throwValidationError: true
275
- });
276
- const idColumnName = `${relationTo}ID`;
277
- result[idColumnName] = one(adapter.tables[relatedTableName], {
278
- fields: [
279
- relationshipsTable[idColumnName]
280
- ],
281
- references: [
282
- adapter.tables[relatedTableName].id
283
- ]
284
- });
285
- });
286
- return result;
287
- });
288
- adapter.relations[`relations_${relationshipsTableName}`] = relationshipsTableRelations;
289
- }
290
- }
291
- const tableRelations = relations(table, ({ many })=>{
292
- const result = {};
293
- relationsToBuild.forEach((val, key)=>{
294
- result[key] = many(adapter.tables[val]);
295
- });
296
- if (hasLocalizedField) {
297
- result._locales = many(localesTable);
298
- }
299
- if (hasManyTextField) {
300
- result._texts = many(textsTable);
301
- }
302
- if (hasManyNumberField) {
303
- result._numbers = many(numbersTable);
304
- }
305
- if (relationships.size && relationshipsTable) {
306
- result._rels = many(relationshipsTable, {
307
- relationName: '_rels'
308
- });
309
- }
310
- return result;
311
- });
312
- adapter.relations[`relations_${tableName}`] = tableRelations;
313
- return {
314
- hasManyNumberField,
315
- hasManyTextField,
316
- relationsToBuild
317
- };
318
- };
319
-
320
- //# sourceMappingURL=build.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/schema/build.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Relation } from 'drizzle-orm'\nimport type {\n ForeignKeyBuilder,\n IndexBuilder,\n PgColumnBuilder,\n PgTableWithColumns,\n UniqueConstraintBuilder,\n} from 'drizzle-orm/pg-core'\nimport type { Field } from 'payload/types'\n\nimport { relations } from 'drizzle-orm'\nimport {\n foreignKey,\n index,\n integer,\n numeric,\n serial,\n timestamp,\n unique,\n varchar,\n} from 'drizzle-orm/pg-core'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { GenericColumns, GenericTable, IDType, PostgresAdapter } from '../types.js'\n\nimport { createTableName } from './createTableName.js'\nimport { parentIDColumnMap } from './parentIDColumnMap.js'\nimport { setColumnID } from './setColumnID.js'\nimport { traverseFields } from './traverseFields.js'\n\nexport type BaseExtraConfig = Record<\n string,\n (cols: GenericColumns) => ForeignKeyBuilder | IndexBuilder | UniqueConstraintBuilder\n>\n\ntype Args = {\n adapter: PostgresAdapter\n baseColumns?: Record<string, PgColumnBuilder>\n baseExtraConfig?: BaseExtraConfig\n buildNumbers?: boolean\n buildRelationships?: boolean\n buildTexts?: boolean\n disableNotNull: boolean\n disableUnique: boolean\n fields: Field[]\n rootRelationsToBuild?: Map<string, string>\n rootRelationships?: Set<string>\n rootTableIDColType?: string\n rootTableName?: string\n tableName: string\n timestamps?: boolean\n versions: boolean\n}\n\ntype Result = {\n hasManyNumberField: 'index' | boolean\n hasManyTextField: 'index' | boolean\n relationsToBuild: Map<string, string>\n}\n\nexport const buildTable = ({\n adapter,\n baseColumns = {},\n baseExtraConfig = {},\n buildNumbers,\n buildRelationships,\n buildTexts,\n disableNotNull,\n disableUnique = false,\n fields,\n rootRelationsToBuild,\n rootRelationships,\n rootTableIDColType,\n rootTableName: incomingRootTableName,\n tableName,\n timestamps,\n versions,\n}: Args): Result => {\n const rootTableName = incomingRootTableName || tableName\n const columns: Record<string, PgColumnBuilder> = baseColumns\n const indexes: Record<string, (cols: GenericColumns) => IndexBuilder> = {}\n\n const localesColumns: Record<string, PgColumnBuilder> = {}\n const localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder> = {}\n let localesTable: GenericTable | PgTableWithColumns<any>\n let textsTable: GenericTable | PgTableWithColumns<any>\n let numbersTable: GenericTable | PgTableWithColumns<any>\n\n // Relationships to the base collection\n const relationships: Set<string> = rootRelationships || new Set()\n\n let relationshipsTable: GenericTable | PgTableWithColumns<any>\n\n // Drizzle relations\n const relationsToBuild: Map<string, string> = new Map()\n\n const idColType: IDType = setColumnID({ adapter, columns, fields })\n\n const {\n hasLocalizedField,\n hasLocalizedManyNumberField,\n hasLocalizedManyTextField,\n hasLocalizedRelationshipField,\n hasManyNumberField,\n hasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columns,\n disableNotNull,\n disableUnique,\n fields,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: tableName,\n parentTableName: tableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild: rootRelationsToBuild || relationsToBuild,\n rootTableIDColType: rootTableIDColType || idColType,\n rootTableName,\n versions,\n })\n\n if (timestamps) {\n columns.createdAt = timestamp('created_at', {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n .defaultNow()\n .notNull()\n columns.updatedAt = timestamp('updated_at', {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n .defaultNow()\n .notNull()\n }\n\n const table = adapter.pgSchema.table(tableName, columns, (cols) => {\n const extraConfig = Object.entries(baseExtraConfig).reduce((config, [key, func]) => {\n config[key] = func(cols)\n return config\n }, {})\n\n const result = Object.entries(indexes).reduce((acc, [colName, func]) => {\n acc[colName] = func(cols)\n return acc\n }, extraConfig)\n\n return result\n })\n\n adapter.tables[tableName] = table\n\n if (hasLocalizedField) {\n const localeTableName = `${tableName}${adapter.localesSuffix}`\n localesColumns.id = serial('id').primaryKey()\n localesColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n localesColumns._parentID = parentIDColumnMap[idColType]('_parent_id').notNull()\n\n localesTable = adapter.pgSchema.table(localeTableName, localesColumns, (cols) => {\n return Object.entries(localesIndexes).reduce(\n (acc, [colName, func]) => {\n acc[colName] = func(cols)\n return acc\n },\n {\n _localeParent: unique(`${localeTableName}_locale_parent_id_unique`).on(\n cols._locale,\n cols._parentID,\n ),\n _parentIdFk: foreignKey({\n name: `${localeTableName}_parent_id_fk`,\n columns: [cols._parentID],\n foreignColumns: [table.id],\n }).onDelete('cascade'),\n },\n )\n })\n\n adapter.tables[localeTableName] = localesTable\n\n const localesTableRelations = relations(localesTable, ({ one }) => ({\n _parentID: one(table, {\n fields: [localesTable._parentID],\n references: [table.id],\n }),\n }))\n\n adapter.relations[`relations_${localeTableName}`] = localesTableRelations\n }\n\n if (hasManyTextField && buildTexts) {\n const textsTableName = `${rootTableName}_texts`\n const columns: Record<string, PgColumnBuilder> = {\n id: serial('id').primaryKey(),\n order: integer('order').notNull(),\n parent: parentIDColumnMap[idColType]('parent_id').notNull(),\n path: varchar('path').notNull(),\n text: varchar('text'),\n }\n\n if (hasLocalizedManyTextField) {\n columns.locale = adapter.enums.enum__locales('locale')\n }\n\n textsTable = adapter.pgSchema.table(textsTableName, columns, (cols) => {\n const config: Record<string, ForeignKeyBuilder | IndexBuilder> = {\n orderParentIdx: index(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent),\n parentFk: foreignKey({\n name: `${textsTableName}_parent_fk`,\n columns: [cols.parent],\n foreignColumns: [table.id],\n }).onDelete('cascade'),\n }\n\n if (hasManyTextField === 'index') {\n config.text_idx = index(`${textsTableName}_text_idx`).on(cols.text)\n }\n\n if (hasLocalizedManyTextField) {\n config.localeParent = index(`${textsTableName}_locale_parent`).on(cols.locale, cols.parent)\n }\n\n return config\n })\n\n adapter.tables[textsTableName] = textsTable\n\n const textsTableRelations = relations(textsTable, ({ one }) => ({\n parent: one(table, {\n fields: [textsTable.parent],\n references: [table.id],\n }),\n }))\n\n adapter.relations[`relations_${textsTableName}`] = textsTableRelations\n }\n\n if (hasManyNumberField && buildNumbers) {\n const numbersTableName = `${rootTableName}_numbers`\n const columns: Record<string, PgColumnBuilder> = {\n id: serial('id').primaryKey(),\n number: numeric('number'),\n order: integer('order').notNull(),\n parent: parentIDColumnMap[idColType]('parent_id').notNull(),\n path: varchar('path').notNull(),\n }\n\n if (hasLocalizedManyNumberField) {\n columns.locale = adapter.enums.enum__locales('locale')\n }\n\n numbersTable = adapter.pgSchema.table(numbersTableName, columns, (cols) => {\n const config: Record<string, ForeignKeyBuilder | IndexBuilder> = {\n orderParentIdx: index(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent),\n parentFk: foreignKey({\n name: `${numbersTableName}_parent_fk`,\n columns: [cols.parent],\n foreignColumns: [table.id],\n }).onDelete('cascade'),\n }\n\n if (hasManyNumberField === 'index') {\n config.numberIdx = index(`${numbersTableName}_number_idx`).on(cols.number)\n }\n\n if (hasLocalizedManyNumberField) {\n config.localeParent = index(`${numbersTableName}_locale_parent`).on(\n cols.locale,\n cols.parent,\n )\n }\n\n return config\n })\n\n adapter.tables[numbersTableName] = numbersTable\n\n const numbersTableRelations = relations(numbersTable, ({ one }) => ({\n parent: one(table, {\n fields: [numbersTable.parent],\n references: [table.id],\n }),\n }))\n\n adapter.relations[`relations_${numbersTableName}`] = numbersTableRelations\n }\n\n if (buildRelationships) {\n if (relationships.size) {\n const relationshipColumns: Record<string, PgColumnBuilder> = {\n id: serial('id').primaryKey(),\n order: integer('order'),\n parent: parentIDColumnMap[idColType]('parent_id').notNull(),\n path: varchar('path').notNull(),\n }\n\n if (hasLocalizedRelationshipField) {\n relationshipColumns.locale = adapter.enums.enum__locales('locale')\n }\n\n const relationExtraConfig: BaseExtraConfig = {}\n\n const relationshipsTableName = `${tableName}${adapter.relationshipsSuffix}`\n\n relationships.forEach((relationTo) => {\n const relationshipConfig = adapter.payload.collections[relationTo].config\n const formattedRelationTo = createTableName({\n adapter,\n config: relationshipConfig,\n throwValidationError: true,\n })\n let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer'\n\n const relatedCollectionCustomIDType =\n adapter.payload.collections[relationshipConfig.slug]?.customIDType\n\n if (relatedCollectionCustomIDType === 'number') colType = 'numeric'\n if (relatedCollectionCustomIDType === 'text') colType = 'varchar'\n\n relationshipColumns[`${relationTo}ID`] = parentIDColumnMap[colType](\n `${formattedRelationTo}_id`,\n )\n\n relationExtraConfig[`${relationTo}IdFk`] = (cols) =>\n foreignKey({\n name: `${relationshipsTableName}_${toSnakeCase(relationTo)}_fk`,\n columns: [cols[`${relationTo}ID`]],\n foreignColumns: [adapter.tables[formattedRelationTo].id],\n }).onDelete('cascade')\n })\n\n relationshipsTable = adapter.pgSchema.table(\n relationshipsTableName,\n relationshipColumns,\n (cols) => {\n const result: Record<string, ForeignKeyBuilder | IndexBuilder> = Object.entries(\n relationExtraConfig,\n ).reduce(\n (config, [key, func]) => {\n config[key] = func(cols)\n return config\n },\n {\n order: index(`${relationshipsTableName}_order_idx`).on(cols.order),\n parentFk: foreignKey({\n name: `${relationshipsTableName}_parent_fk`,\n columns: [cols.parent],\n foreignColumns: [table.id],\n }).onDelete('cascade'),\n parentIdx: index(`${relationshipsTableName}_parent_idx`).on(cols.parent),\n pathIdx: index(`${relationshipsTableName}_path_idx`).on(cols.path),\n },\n )\n\n if (hasLocalizedRelationshipField) {\n result.localeIdx = index(`${relationshipsTableName}_locale_idx`).on(cols.locale)\n }\n\n return result\n },\n )\n\n adapter.tables[relationshipsTableName] = relationshipsTable\n\n const relationshipsTableRelations = relations(relationshipsTable, ({ one }) => {\n const result: Record<string, Relation<string>> = {\n parent: one(table, {\n fields: [relationshipsTable.parent],\n references: [table.id],\n relationName: '_rels',\n }),\n }\n\n relationships.forEach((relationTo) => {\n const relatedTableName = createTableName({\n adapter,\n config: adapter.payload.collections[relationTo].config,\n throwValidationError: true,\n })\n const idColumnName = `${relationTo}ID`\n result[idColumnName] = one(adapter.tables[relatedTableName], {\n fields: [relationshipsTable[idColumnName]],\n references: [adapter.tables[relatedTableName].id],\n })\n })\n\n return result\n })\n\n adapter.relations[`relations_${relationshipsTableName}`] = relationshipsTableRelations\n }\n }\n\n const tableRelations = relations(table, ({ many }) => {\n const result: Record<string, Relation<string>> = {}\n\n relationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n if (hasLocalizedField) {\n result._locales = many(localesTable)\n }\n\n if (hasManyTextField) {\n result._texts = many(textsTable)\n }\n if (hasManyNumberField) {\n result._numbers = many(numbersTable)\n }\n\n if (relationships.size && relationshipsTable) {\n result._rels = many(relationshipsTable, {\n relationName: '_rels',\n })\n }\n\n return result\n })\n\n adapter.relations[`relations_${tableName}`] = tableRelations\n\n return { hasManyNumberField, hasManyTextField, relationsToBuild }\n}\n"],"names":["relations","foreignKey","index","integer","numeric","serial","timestamp","unique","varchar","toSnakeCase","createTableName","parentIDColumnMap","setColumnID","traverseFields","buildTable","adapter","baseColumns","baseExtraConfig","buildNumbers","buildRelationships","buildTexts","disableNotNull","disableUnique","fields","rootRelationsToBuild","rootRelationships","rootTableIDColType","rootTableName","incomingRootTableName","tableName","timestamps","versions","columns","indexes","localesColumns","localesIndexes","localesTable","textsTable","numbersTable","relationships","Set","relationshipsTable","relationsToBuild","Map","idColType","hasLocalizedField","hasLocalizedManyNumberField","hasLocalizedManyTextField","hasLocalizedRelationshipField","hasManyNumberField","hasManyTextField","newTableName","parentTableName","createdAt","mode","precision","withTimezone","defaultNow","notNull","updatedAt","table","pgSchema","cols","extraConfig","Object","entries","reduce","config","key","func","result","acc","colName","tables","localeTableName","localesSuffix","id","primaryKey","_locale","enums","enum__locales","_parentID","_localeParent","on","_parentIdFk","name","foreignColumns","onDelete","localesTableRelations","one","references","textsTableName","order","parent","path","text","locale","orderParentIdx","parentFk","text_idx","localeParent","textsTableRelations","numbersTableName","number","numberIdx","numbersTableRelations","size","relationshipColumns","relationExtraConfig","relationshipsTableName","relationshipsSuffix","forEach","relationTo","relationshipConfig","payload","collections","formattedRelationTo","throwValidationError","colType","idType","relatedCollectionCustomIDType","slug","customIDType","parentIdx","pathIdx","localeIdx","relationshipsTableRelations","relationName","relatedTableName","idColumnName","tableRelations","many","val","_locales","_texts","_numbers","_rels"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAWpC,SAASA,SAAS,QAAQ,cAAa;AACvC,SACEC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,SAAS,EACTC,MAAM,EACNC,OAAO,QACF,sBAAqB;AAC5B,OAAOC,iBAAiB,gBAAe;AAIvC,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,cAAc,QAAQ,sBAAqB;AAgCpD,OAAO,MAAMC,aAAa,CAAC,EACzBC,OAAO,EACPC,cAAc,CAAC,CAAC,EAChBC,kBAAkB,CAAC,CAAC,EACpBC,YAAY,EACZC,kBAAkB,EAClBC,UAAU,EACVC,cAAc,EACdC,gBAAgB,KAAK,EACrBC,MAAM,EACNC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAeC,qBAAqB,EACpCC,SAAS,EACTC,UAAU,EACVC,QA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;YAEAvD,QAAQf,SAAS,CAAC,CAAC,UAAU,EAAE6G,uBAAuB,CAAC,CAAC,GAAGiB;QAC7D;IACF;IAEA,MAAMI,iBAAiBlI,UAAU4D,OAAO,CAAC,EAAEuE,IAAI,EAAE;QAC/C,MAAM7D,SAA2C,CAAC;QAElD5B,iBAAiBqE,OAAO,CAAC,CAACqB,KAAKhE;YAC7BE,MAAM,CAACF,IAAI,GAAG+D,KAAKpH,QAAQ0D,MAAM,CAAC2D,IAAI;QACxC;QAEA,IAAIvF,mBAAmB;YACrByB,OAAO+D,QAAQ,GAAGF,KAAK/F;QACzB;QAEA,IAAIc,kBAAkB;YACpBoB,OAAOgE,MAAM,GAAGH,KAAK9F;QACvB;QACA,IAAIY,oBAAoB;YACtBqB,OAAOiE,QAAQ,GAAGJ,KAAK7F;QACzB;QAEA,IAAIC,cAAcmE,IAAI,IAAIjE,oBAAoB;YAC5C6B,OAAOkE,KAAK,GAAGL,KAAK1F,oBAAoB;gBACtCsF,cAAc;YAChB;QACF;QAEA,OAAOzD;IACT;IAEAvD,QAAQf,SAAS,CAAC,CAAC,UAAU,EAAE6B,UAAU,CAAC,CAAC,GAAGqG;IAE9C,OAAO;QAAEjF;QAAoBC;QAAkBR;IAAiB;AAClE,EAAC"}
@@ -1,12 +0,0 @@
1
- import type { GenericColumn } from '../types.js';
2
- type CreateIndexArgs = {
3
- columnName: string;
4
- name: string | string[];
5
- tableName: string;
6
- unique?: boolean;
7
- };
8
- export declare const createIndex: ({ name, columnName, tableName, unique }: CreateIndexArgs) => (table: {
9
- [x: string]: GenericColumn;
10
- }) => import("drizzle-orm/pg-core").IndexBuilder;
11
- export {};
12
- //# sourceMappingURL=createIndex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createIndex.d.ts","sourceRoot":"","sources":["../../src/schema/createIndex.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,KAAK,eAAe,GAAG;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,WAAW,4CAA6C,eAAe,aACnE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,+CAc9C,CAAA"}
@@ -1,18 +0,0 @@
1
- /* eslint-disable no-param-reassign */ import { index, uniqueIndex } from 'drizzle-orm/pg-core';
2
- export const createIndex = ({ name, columnName, tableName, unique })=>{
3
- return (table)=>{
4
- let columns;
5
- if (Array.isArray(name)) {
6
- columns = name.map((columnName)=>table[columnName])// exclude fields were included in compound indexes but do not exist on the table
7
- .filter((col)=>typeof col !== 'undefined');
8
- } else {
9
- columns = [
10
- table[name]
11
- ];
12
- }
13
- if (unique) return uniqueIndex(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1));
14
- return index(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1));
15
- };
16
- };
17
-
18
- //# sourceMappingURL=createIndex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/schema/createIndex.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { index, uniqueIndex } from 'drizzle-orm/pg-core'\n\nimport type { GenericColumn } from '../types.js'\n\ntype CreateIndexArgs = {\n columnName: string\n name: string | string[]\n tableName: string\n unique?: boolean\n}\n\nexport const createIndex = ({ name, columnName, tableName, unique }: CreateIndexArgs) => {\n return (table: { [x: string]: GenericColumn }) => {\n let columns\n if (Array.isArray(name)) {\n columns = name\n .map((columnName) => table[columnName])\n // exclude fields were included in compound indexes but do not exist on the table\n .filter((col) => typeof col !== 'undefined')\n } else {\n columns = [table[name]]\n }\n if (unique)\n return uniqueIndex(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1))\n return index(`${tableName}_${columnName}_idx`).on(columns[0], ...columns.slice(1))\n }\n}\n"],"names":["index","uniqueIndex","createIndex","name","columnName","tableName","unique","table","columns","Array","isArray","map","filter","col","on","slice"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GACpC,SAASA,KAAK,EAAEC,WAAW,QAAQ,sBAAqB;AAWxD,OAAO,MAAMC,cAAc,CAAC,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAmB;IAClF,OAAO,CAACC;QACN,IAAIC;QACJ,IAAIC,MAAMC,OAAO,CAACP,OAAO;YACvBK,UAAUL,KACPQ,GAAG,CAAC,CAACP,aAAeG,KAAK,CAACH,WAAW,CACtC,iFAAiF;aAChFQ,MAAM,CAAC,CAACC,MAAQ,OAAOA,QAAQ;QACpC,OAAO;YACLL,UAAU;gBAACD,KAAK,CAACJ,KAAK;aAAC;QACzB;QACA,IAAIG,QACF,OAAOL,YAAY,CAAC,EAAEI,UAAU,CAAC,EAAED,WAAW,IAAI,CAAC,EAAEU,EAAE,CAACN,OAAO,CAAC,EAAE,KAAKA,QAAQO,KAAK,CAAC;QACvF,OAAOf,MAAM,CAAC,EAAEK,UAAU,CAAC,EAAED,WAAW,IAAI,CAAC,EAAEU,EAAE,CAACN,OAAO,CAAC,EAAE,KAAKA,QAAQO,KAAK,CAAC;IACjF;AACF,EAAC"}
@@ -1,30 +0,0 @@
1
- import type { DBIdentifierName } from 'payload/database';
2
- import type { PostgresAdapter } from '../types.js';
3
- type Args = {
4
- adapter: PostgresAdapter;
5
- /** The collection, global or field config **/
6
- config: {
7
- dbName?: DBIdentifierName;
8
- enumName?: DBIdentifierName;
9
- name?: string;
10
- slug?: string;
11
- };
12
- /** For nested tables passed for the user custom dbName functions to handle their own iterations */
13
- parentTableName?: string;
14
- /** For sub tables (array for example) this needs to include the parentTableName */
15
- prefix?: string;
16
- /** For tables based on fields that could have both enumName and dbName (ie: select with hasMany), default: 'dbName' */
17
- target?: 'dbName' | 'enumName';
18
- throwValidationError?: boolean;
19
- /** Adds the versions suffix to the default table name - should only be used on the base collection to avoid duplicate suffixing */
20
- versions?: boolean;
21
- /** Adds the versions suffix to custom dbName only - this is used while creating blocks / selects / arrays / etc */
22
- versionsCustomName?: boolean;
23
- };
24
- /**
25
- * Used to name database enums and tables
26
- * Returns the table or enum name for a given entity
27
- */
28
- export declare const createTableName: ({ adapter, config: { name, slug }, config, parentTableName, prefix, target, throwValidationError, versions, versionsCustomName, }: Args) => string;
29
- export {};
30
- //# sourceMappingURL=createTableName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createTableName.d.ts","sourceRoot":"","sources":["../../src/schema/createTableName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAKxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,8CAA8C;IAC9C,MAAM,EAAE;QACN,MAAM,CAAC,EAAE,gBAAgB,CAAA;QACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAA;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,uHAAuH;IACvH,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,mIAAmI;IACnI,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mHAAmH;IACnH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,sIAUzB,IAAI,KAAG,MAsCT,CAAA"}
@@ -1,31 +0,0 @@
1
- import { APIError } from 'payload/errors';
2
- import toSnakeCase from 'to-snake-case';
3
- /**
4
- * Used to name database enums and tables
5
- * Returns the table or enum name for a given entity
6
- */ export const createTableName = ({ adapter, config: { name, slug }, config, parentTableName, prefix = '', target = 'dbName', throwValidationError = false, versions = false, versionsCustomName = false })=>{
7
- let customNameDefinition = config[target];
8
- let defaultTableName = `${prefix}${toSnakeCase(name ?? slug)}`;
9
- if (versions) defaultTableName = `_${defaultTableName}${adapter.versionsSuffix}`;
10
- let customTableNameResult;
11
- if (!customNameDefinition && target === 'enumName') {
12
- customNameDefinition = config['dbName'];
13
- }
14
- if (customNameDefinition) {
15
- customTableNameResult = typeof customNameDefinition === 'function' ? customNameDefinition({
16
- tableName: parentTableName
17
- }) : customNameDefinition;
18
- if (versionsCustomName) customTableNameResult = `_${customTableNameResult}${adapter.versionsSuffix}`;
19
- }
20
- const result = customTableNameResult || defaultTableName;
21
- adapter.tableNameMap.set(defaultTableName, result);
22
- if (!throwValidationError) {
23
- return result;
24
- }
25
- if (result.length > 63) {
26
- throw new APIError(`Exceeded max identifier length for table or enum name of 63 characters. Invalid name: ${result}`);
27
- }
28
- return result;
29
- };
30
-
31
- //# sourceMappingURL=createTableName.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/schema/createTableName.ts"],"sourcesContent":["import type { DBIdentifierName } from 'payload/database'\n\nimport { APIError } from 'payload/errors'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n /** The collection, global or field config **/\n config: {\n dbName?: DBIdentifierName\n enumName?: DBIdentifierName\n name?: string\n slug?: string\n }\n /** For nested tables passed for the user custom dbName functions to handle their own iterations */\n parentTableName?: string\n /** For sub tables (array for example) this needs to include the parentTableName */\n prefix?: string\n /** For tables based on fields that could have both enumName and dbName (ie: select with hasMany), default: 'dbName' */\n target?: 'dbName' | 'enumName'\n throwValidationError?: boolean\n /** Adds the versions suffix to the default table name - should only be used on the base collection to avoid duplicate suffixing */\n versions?: boolean\n /** Adds the versions suffix to custom dbName only - this is used while creating blocks / selects / arrays / etc */\n versionsCustomName?: boolean\n}\n\n/**\n * Used to name database enums and tables\n * Returns the table or enum name for a given entity\n */\nexport const createTableName = ({\n adapter,\n config: { name, slug },\n config,\n parentTableName,\n prefix = '',\n target = 'dbName',\n throwValidationError = false,\n versions = false,\n versionsCustomName = false,\n}: Args): string => {\n let customNameDefinition = config[target]\n\n let defaultTableName = `${prefix}${toSnakeCase(name ?? slug)}`\n\n if (versions) defaultTableName = `_${defaultTableName}${adapter.versionsSuffix}`\n\n let customTableNameResult: string\n\n if (!customNameDefinition && target === 'enumName') {\n customNameDefinition = config['dbName']\n }\n\n if (customNameDefinition) {\n customTableNameResult =\n typeof customNameDefinition === 'function'\n ? customNameDefinition({ tableName: parentTableName })\n : customNameDefinition\n\n if (versionsCustomName)\n customTableNameResult = `_${customTableNameResult}${adapter.versionsSuffix}`\n }\n\n const result = customTableNameResult || defaultTableName\n\n adapter.tableNameMap.set(defaultTableName, result)\n\n if (!throwValidationError) {\n return result\n }\n\n if (result.length > 63) {\n throw new APIError(\n `Exceeded max identifier length for table or enum name of 63 characters. Invalid name: ${result}`,\n )\n }\n\n return result\n}\n"],"names":["APIError","toSnakeCase","createTableName","adapter","config","name","slug","parentTableName","prefix","target","throwValidationError","versions","versionsCustomName","customNameDefinition","defaultTableName","versionsSuffix","customTableNameResult","tableName","result","tableNameMap","set","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,QAAQ,QAAQ,iBAAgB;AACzC,OAAOC,iBAAiB,gBAAe;AA0BvC;;;CAGC,GACD,OAAO,MAAMC,kBAAkB,CAAC,EAC9BC,OAAO,EACPC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,EAAE,EACtBF,MAAM,EACNG,eAAe,EACfC,SAAS,EAAE,EACXC,SAAS,QAAQ,EACjBC,uBAAuB,KAAK,EAC5BC,WAAW,KAAK,EAChBC,qBAAqB,KAAK,EACrB;IACL,IAAIC,uBAAuBT,MAAM,CAACK,OAAO;IAEzC,IAAIK,mBAAmB,CAAC,EAAEN,OAAO,EAAEP,YAAYI,QAAQC,MAAM,CAAC;IAE9D,IAAIK,UAAUG,mBAAmB,CAAC,CAAC,EAAEA,iBAAiB,EAAEX,QAAQY,cAAc,CAAC,CAAC;IAEhF,IAAIC;IAEJ,IAAI,CAACH,wBAAwBJ,WAAW,YAAY;QAClDI,uBAAuBT,MAAM,CAAC,SAAS;IACzC;IAEA,IAAIS,sBAAsB;QACxBG,wBACE,OAAOH,yBAAyB,aAC5BA,qBAAqB;YAAEI,WAAWV;QAAgB,KAClDM;QAEN,IAAID,oBACFI,wBAAwB,CAAC,CAAC,EAAEA,sBAAsB,EAAEb,QAAQY,cAAc,CAAC,CAAC;IAChF;IAEA,MAAMG,SAASF,yBAAyBF;IAExCX,QAAQgB,YAAY,CAACC,GAAG,CAACN,kBAAkBI;IAE3C,IAAI,CAACR,sBAAsB;QACzB,OAAOQ;IACT;IAEA,IAAIA,OAAOG,MAAM,GAAG,IAAI;QACtB,MAAM,IAAIrB,SACR,CAAC,sFAAsF,EAAEkB,OAAO,CAAC;IAErG;IAEA,OAAOA;AACT,EAAC"}
@@ -1,3 +0,0 @@
1
- import type { Field } from 'payload/types';
2
- export declare const idToUUID: (fields: Field[]) => Field[];
3
- //# sourceMappingURL=idToUUID.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idToUUID.d.ts","sourceRoot":"","sources":["../../src/schema/idToUUID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,eAAO,MAAM,QAAQ,WAAY,KAAK,EAAE,KAAG,KAAK,EAU5C,CAAA"}
@@ -1,11 +0,0 @@
1
- export const idToUUID = (fields)=>fields.map((field)=>{
2
- if ('name' in field && field.name === 'id') {
3
- return {
4
- ...field,
5
- name: '_uuid'
6
- };
7
- }
8
- return field;
9
- });
10
-
11
- //# sourceMappingURL=idToUUID.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/schema/idToUUID.ts"],"sourcesContent":["import type { Field } from 'payload/types'\n\nexport const idToUUID = (fields: Field[]): Field[] =>\n fields.map((field) => {\n if ('name' in field && field.name === 'id') {\n return {\n ...field,\n name: '_uuid',\n }\n }\n\n return field\n })\n"],"names":["idToUUID","fields","map","field","name"],"rangeMappings":";;;;;;;;","mappings":"AAEA,OAAO,MAAMA,WAAW,CAACC,SACvBA,OAAOC,GAAG,CAAC,CAACC;QACV,IAAI,UAAUA,SAASA,MAAMC,IAAI,KAAK,MAAM;YAC1C,OAAO;gBACL,GAAGD,KAAK;gBACRC,MAAM;YACR;QACF;QAEA,OAAOD;IACT,GAAE"}
@@ -1,4 +0,0 @@
1
- import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core';
2
- import type { IDType } from '../types.js';
3
- export declare const parentIDColumnMap: Record<IDType, typeof integer<string> | typeof numeric<string> | typeof uuid<string> | typeof varchar>;
4
- //# sourceMappingURL=parentIDColumnMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parentIDColumnMap.d.ts","sourceRoot":"","sources":["../../src/schema/parentIDColumnMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAErE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,MAAM,EACN,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,OAAO,CAMvF,CAAA"}
@@ -1,9 +0,0 @@
1
- import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core';
2
- export const parentIDColumnMap = {
3
- integer,
4
- numeric,
5
- uuid,
6
- varchar
7
- };
8
-
9
- //# sourceMappingURL=parentIDColumnMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/schema/parentIDColumnMap.ts"],"sourcesContent":["import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core'\n\nimport type { IDType } from '../types.js'\n\nexport const parentIDColumnMap: Record<\n IDType,\n typeof integer<string> | typeof numeric<string> | typeof uuid<string> | typeof varchar\n> = {\n integer,\n numeric,\n uuid,\n varchar,\n}\n"],"names":["integer","numeric","uuid","varchar","parentIDColumnMap"],"rangeMappings":";;;;;;","mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,QAAQ,sBAAqB;AAIrE,OAAO,MAAMC,oBAGT;IACFJ;IACAC;IACAC;IACAC;AACF,EAAC"}
@@ -1,11 +0,0 @@
1
- import type { PgColumnBuilder } from 'drizzle-orm/pg-core';
2
- import { type Field } from 'payload/types';
3
- import type { IDType, PostgresAdapter } from '../types.js';
4
- type Args = {
5
- adapter: PostgresAdapter;
6
- columns: Record<string, PgColumnBuilder>;
7
- fields: Field[];
8
- };
9
- export declare const setColumnID: ({ adapter, columns, fields }: Args) => IDType;
10
- export {};
11
- //# sourceMappingURL=setColumnID.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setColumnID.d.ts","sourceRoot":"","sources":["../../src/schema/setColumnID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAG1D,OAAO,EAAE,KAAK,KAAK,EAAoB,MAAM,eAAe,CAAA;AAG5D,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE1D,KAAK,IAAI,GAAG;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAE,CAAA;AACnG,eAAO,MAAM,WAAW,iCAAkC,IAAI,KAAG,MAuBhE,CAAA"}
@@ -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,38 +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
- type Args = {
5
- adapter: PostgresAdapter;
6
- buildNumbers: boolean;
7
- buildRelationships: boolean;
8
- buildTexts: boolean;
9
- columnPrefix?: string;
10
- columns: Record<string, PgColumnBuilder>;
11
- disableNotNull: boolean;
12
- disableUnique?: boolean;
13
- fieldPrefix?: string;
14
- fields: (Field | TabAsField)[];
15
- forceLocalized?: boolean;
16
- indexes: Record<string, (cols: GenericColumns) => IndexBuilder>;
17
- localesColumns: Record<string, PgColumnBuilder>;
18
- localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>;
19
- newTableName: string;
20
- parentTableName: string;
21
- relationsToBuild: Map<string, string>;
22
- relationships: Set<string>;
23
- rootRelationsToBuild?: Map<string, string>;
24
- rootTableIDColType: string;
25
- rootTableName: string;
26
- versions: boolean;
27
- };
28
- type Result = {
29
- hasLocalizedField: boolean;
30
- hasLocalizedManyNumberField: boolean;
31
- hasLocalizedManyTextField: boolean;
32
- hasLocalizedRelationshipField: boolean;
33
- hasManyNumberField: 'index' | boolean;
34
- hasManyTextField: 'index' | boolean;
35
- };
36
- export declare const traverseFields: ({ adapter, buildNumbers, buildRelationships, buildTexts, columnPrefix, columns, disableNotNull, disableUnique, fieldPrefix, fields, forceLocalized, indexes, localesColumns, localesIndexes, newTableName, parentTableName, relationsToBuild, relationships, rootRelationsToBuild, rootTableIDColType, rootTableName, versions, }: Args) => Result;
37
- export {};
38
- //# sourceMappingURL=traverseFields.d.ts.map