@payloadcms/db-postgres 3.0.0-canary.f1db24e → 3.0.0-canary.f1f97ff

Sign up to get free protection for your applications and to get access to all the features.
Files changed (406) 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 +5 -6
  5. package/dist/connect.js.map +1 -1
  6. package/dist/countDistinct.d.ts +3 -0
  7. package/dist/countDistinct.d.ts.map +1 -0
  8. package/dist/countDistinct.js +24 -0
  9. package/dist/countDistinct.js.map +1 -0
  10. package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
  11. package/dist/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
  12. package/dist/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
  13. package/dist/createJSONQuery/formatJSONPathSegment.js.map +1 -0
  14. package/dist/createJSONQuery/index.d.ts.map +1 -0
  15. package/dist/createJSONQuery/index.js.map +1 -0
  16. package/dist/createMigration.d.ts +1 -1
  17. package/dist/createMigration.d.ts.map +1 -1
  18. package/dist/createMigration.js +60 -56
  19. package/dist/createMigration.js.map +1 -1
  20. package/dist/defaultSnapshot.d.ts +3 -0
  21. package/dist/defaultSnapshot.d.ts.map +1 -0
  22. package/dist/defaultSnapshot.js +17 -0
  23. package/dist/defaultSnapshot.js.map +1 -0
  24. package/dist/deleteWhere.d.ts +3 -0
  25. package/dist/deleteWhere.d.ts.map +1 -0
  26. package/dist/deleteWhere.js +6 -0
  27. package/dist/deleteWhere.js.map +1 -0
  28. package/dist/dropDatabase.d.ts +3 -0
  29. package/dist/dropDatabase.d.ts.map +1 -0
  30. package/dist/dropDatabase.js +9 -0
  31. package/dist/dropDatabase.js.map +1 -0
  32. package/dist/execute.d.ts +3 -0
  33. package/dist/execute.d.ts.map +1 -0
  34. package/dist/execute.js +11 -0
  35. package/dist/execute.js.map +1 -0
  36. package/dist/exports/migration-utils.d.ts +2 -0
  37. package/dist/exports/migration-utils.d.ts.map +1 -0
  38. package/dist/exports/migration-utils.js +3 -0
  39. package/dist/exports/migration-utils.js.map +1 -0
  40. package/dist/getMigrationTemplate.d.ts +3 -0
  41. package/dist/getMigrationTemplate.d.ts.map +1 -0
  42. package/dist/getMigrationTemplate.js +12 -0
  43. package/dist/getMigrationTemplate.js.map +1 -0
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +39 -65
  47. package/dist/index.js.map +1 -1
  48. package/dist/init.d.ts +1 -1
  49. package/dist/init.d.ts.map +1 -1
  50. package/dist/init.js +17 -30
  51. package/dist/init.js.map +1 -1
  52. package/dist/insert.d.ts +3 -0
  53. package/dist/insert.d.ts.map +1 -0
  54. package/dist/insert.js +12 -0
  55. package/dist/insert.js.map +1 -0
  56. package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
  57. package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
  58. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
  59. package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
  60. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
  61. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
  62. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
  63. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
  64. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
  65. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
  66. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +191 -0
  67. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
  68. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
  69. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
  70. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
  71. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
  72. package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
  73. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
  74. package/dist/predefinedMigrations/v2-v3/index.js +211 -0
  75. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
  76. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
  77. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
  78. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +57 -0
  79. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
  80. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
  81. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
  82. package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
  83. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
  84. package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
  85. package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
  86. package/dist/predefinedMigrations/v2-v3/types.js +6 -0
  87. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
  88. package/dist/requireDrizzleKit.d.ts +3 -0
  89. package/dist/requireDrizzleKit.d.ts.map +1 -0
  90. package/dist/requireDrizzleKit.js +5 -0
  91. package/dist/requireDrizzleKit.js.map +1 -0
  92. package/dist/schema/build.d.ts +9 -5
  93. package/dist/schema/build.d.ts.map +1 -1
  94. package/dist/schema/build.js +163 -114
  95. package/dist/schema/build.js.map +1 -1
  96. package/dist/schema/createIndex.d.ts.map +1 -1
  97. package/dist/schema/createIndex.js +1 -1
  98. package/dist/schema/createIndex.js.map +1 -1
  99. package/dist/schema/idToUUID.d.ts +1 -1
  100. package/dist/schema/idToUUID.d.ts.map +1 -1
  101. package/dist/schema/idToUUID.js.map +1 -1
  102. package/dist/schema/parentIDColumnMap.js.map +1 -1
  103. package/dist/schema/setColumnID.d.ts +1 -1
  104. package/dist/schema/setColumnID.d.ts.map +1 -1
  105. package/dist/schema/setColumnID.js +2 -2
  106. package/dist/schema/setColumnID.js.map +1 -1
  107. package/dist/schema/traverseFields.d.ts +5 -7
  108. package/dist/schema/traverseFields.d.ts.map +1 -1
  109. package/dist/schema/traverseFields.js +118 -56
  110. package/dist/schema/traverseFields.js.map +1 -1
  111. package/dist/schema/withDefault.d.ts +4 -0
  112. package/dist/schema/withDefault.d.ts.map +1 -0
  113. package/dist/schema/withDefault.js +10 -0
  114. package/dist/schema/withDefault.js.map +1 -0
  115. package/dist/types.d.ts +82 -36
  116. package/dist/types.d.ts.map +1 -1
  117. package/dist/types.js.map +1 -1
  118. package/package.json +24 -15
  119. package/dist/count.d.ts +0 -3
  120. package/dist/count.d.ts.map +0 -1
  121. package/dist/count.js +0 -50
  122. package/dist/count.js.map +0 -1
  123. package/dist/create.d.ts +0 -3
  124. package/dist/create.d.ts.map +0 -1
  125. package/dist/create.js +0 -19
  126. package/dist/create.js.map +0 -1
  127. package/dist/createGlobal.d.ts +0 -5
  128. package/dist/createGlobal.d.ts.map +0 -1
  129. package/dist/createGlobal.js +0 -19
  130. package/dist/createGlobal.js.map +0 -1
  131. package/dist/createGlobalVersion.d.ts +0 -6
  132. package/dist/createGlobalVersion.d.ts.map +0 -1
  133. package/dist/createGlobalVersion.js +0 -33
  134. package/dist/createGlobalVersion.js.map +0 -1
  135. package/dist/createVersion.d.ts +0 -5
  136. package/dist/createVersion.d.ts.map +0 -1
  137. package/dist/createVersion.js +0 -44
  138. package/dist/createVersion.js.map +0 -1
  139. package/dist/deleteMany.d.ts +0 -3
  140. package/dist/deleteMany.d.ts.map +0 -1
  141. package/dist/deleteMany.js +0 -28
  142. package/dist/deleteMany.js.map +0 -1
  143. package/dist/deleteOne.d.ts +0 -3
  144. package/dist/deleteOne.d.ts.map +0 -1
  145. package/dist/deleteOne.js +0 -59
  146. package/dist/deleteOne.js.map +0 -1
  147. package/dist/deleteVersions.d.ts +0 -3
  148. package/dist/deleteVersions.d.ts.map +0 -1
  149. package/dist/deleteVersions.js +0 -31
  150. package/dist/deleteVersions.js.map +0 -1
  151. package/dist/destroy.d.ts +0 -3
  152. package/dist/destroy.d.ts.map +0 -1
  153. package/dist/destroy.js +0 -15
  154. package/dist/destroy.js.map +0 -1
  155. package/dist/find/buildFindManyArgs.d.ts +0 -13
  156. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  157. package/dist/find/buildFindManyArgs.js +0 -64
  158. package/dist/find/buildFindManyArgs.js.map +0 -1
  159. package/dist/find/chainMethods.d.ts +0 -16
  160. package/dist/find/chainMethods.d.ts.map +0 -1
  161. package/dist/find/chainMethods.js +0 -12
  162. package/dist/find/chainMethods.js.map +0 -1
  163. package/dist/find/findMany.d.ts +0 -22
  164. package/dist/find/findMany.d.ts.map +0 -1
  165. package/dist/find/findMany.js +0 -163
  166. package/dist/find/findMany.js.map +0 -1
  167. package/dist/find/traverseFields.d.ts +0 -16
  168. package/dist/find/traverseFields.d.ts.map +0 -1
  169. package/dist/find/traverseFields.js +0 -138
  170. package/dist/find/traverseFields.js.map +0 -1
  171. package/dist/find.d.ts +0 -3
  172. package/dist/find.d.ts.map +0 -1
  173. package/dist/find.js +0 -21
  174. package/dist/find.js.map +0 -1
  175. package/dist/findGlobal.d.ts +0 -3
  176. package/dist/findGlobal.d.ts.map +0 -1
  177. package/dist/findGlobal.js +0 -23
  178. package/dist/findGlobal.js.map +0 -1
  179. package/dist/findGlobalVersions.d.ts +0 -3
  180. package/dist/findGlobalVersions.d.ts.map +0 -1
  181. package/dist/findGlobalVersions.js +0 -24
  182. package/dist/findGlobalVersions.js.map +0 -1
  183. package/dist/findOne.d.ts +0 -5
  184. package/dist/findOne.d.ts.map +0 -1
  185. package/dist/findOne.js +0 -21
  186. package/dist/findOne.js.map +0 -1
  187. package/dist/findVersions.d.ts +0 -3
  188. package/dist/findVersions.d.ts.map +0 -1
  189. package/dist/findVersions.js +0 -24
  190. package/dist/findVersions.js.map +0 -1
  191. package/dist/migrate.d.ts +0 -3
  192. package/dist/migrate.d.ts.map +0 -1
  193. package/dist/migrate.js +0 -99
  194. package/dist/migrate.js.map +0 -1
  195. package/dist/migrateDown.d.ts +0 -3
  196. package/dist/migrateDown.d.ts.map +0 -1
  197. package/dist/migrateDown.js +0 -63
  198. package/dist/migrateDown.js.map +0 -1
  199. package/dist/migrateFresh.d.ts +0 -8
  200. package/dist/migrateFresh.d.ts.map +0 -1
  201. package/dist/migrateFresh.js +0 -72
  202. package/dist/migrateFresh.js.map +0 -1
  203. package/dist/migrateRefresh.d.ts +0 -6
  204. package/dist/migrateRefresh.d.ts.map +0 -1
  205. package/dist/migrateRefresh.js +0 -102
  206. package/dist/migrateRefresh.js.map +0 -1
  207. package/dist/migrateReset.d.ts +0 -6
  208. package/dist/migrateReset.d.ts.map +0 -1
  209. package/dist/migrateReset.js +0 -82
  210. package/dist/migrateReset.js.map +0 -1
  211. package/dist/migrateStatus.d.ts +0 -3
  212. package/dist/migrateStatus.d.ts.map +0 -1
  213. package/dist/migrateStatus.js +0 -44
  214. package/dist/migrateStatus.js.map +0 -1
  215. package/dist/queries/buildAndOrConditions.d.ts +0 -17
  216. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  217. package/dist/queries/buildAndOrConditions.js +0 -29
  218. package/dist/queries/buildAndOrConditions.js.map +0 -1
  219. package/dist/queries/buildQuery.d.ts +0 -31
  220. package/dist/queries/buildQuery.d.ts.map +0 -1
  221. package/dist/queries/buildQuery.js +0 -76
  222. package/dist/queries/buildQuery.js.map +0 -1
  223. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  224. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  225. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  226. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  227. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  228. package/dist/queries/createJSONQuery/index.js.map +0 -1
  229. package/dist/queries/getTableColumnFromPath.d.ts +0 -51
  230. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  231. package/dist/queries/getTableColumnFromPath.js +0 -445
  232. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  233. package/dist/queries/operatorMap.d.ts +0 -18
  234. package/dist/queries/operatorMap.d.ts.map +0 -1
  235. package/dist/queries/operatorMap.js +0 -24
  236. package/dist/queries/operatorMap.js.map +0 -1
  237. package/dist/queries/parseParams.d.ts +0 -17
  238. package/dist/queries/parseParams.d.ts.map +0 -1
  239. package/dist/queries/parseParams.js +0 -185
  240. package/dist/queries/parseParams.js.map +0 -1
  241. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  242. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  243. package/dist/queries/sanitizeQueryValue.js +0 -90
  244. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  245. package/dist/queries/selectDistinct.d.ts +0 -23
  246. package/dist/queries/selectDistinct.d.ts.map +0 -1
  247. package/dist/queries/selectDistinct.js +0 -41
  248. package/dist/queries/selectDistinct.js.map +0 -1
  249. package/dist/queryDrafts.d.ts +0 -3
  250. package/dist/queryDrafts.d.ts.map +0 -1
  251. package/dist/queryDrafts.js +0 -41
  252. package/dist/queryDrafts.js.map +0 -1
  253. package/dist/schema/createTableName.d.ts +0 -30
  254. package/dist/schema/createTableName.d.ts.map +0 -1
  255. package/dist/schema/createTableName.js +0 -31
  256. package/dist/schema/createTableName.js.map +0 -1
  257. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
  258. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  259. package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
  260. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  261. package/dist/transactions/beginTransaction.d.ts +0 -3
  262. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  263. package/dist/transactions/beginTransaction.js +0 -51
  264. package/dist/transactions/beginTransaction.js.map +0 -1
  265. package/dist/transactions/commitTransaction.d.ts +0 -3
  266. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  267. package/dist/transactions/commitTransaction.js +0 -14
  268. package/dist/transactions/commitTransaction.js.map +0 -1
  269. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  270. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  271. package/dist/transactions/rollbackTransaction.js +0 -13
  272. package/dist/transactions/rollbackTransaction.js.map +0 -1
  273. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  274. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  275. package/dist/transform/read/hasManyNumber.js +0 -10
  276. package/dist/transform/read/hasManyNumber.js.map +0 -1
  277. package/dist/transform/read/hasManyText.d.ts +0 -10
  278. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  279. package/dist/transform/read/hasManyText.js +0 -10
  280. package/dist/transform/read/hasManyText.js.map +0 -1
  281. package/dist/transform/read/index.d.ts +0 -12
  282. package/dist/transform/read/index.d.ts.map +0 -1
  283. package/dist/transform/read/index.js +0 -43
  284. package/dist/transform/read/index.js.map +0 -1
  285. package/dist/transform/read/relationship.d.ts +0 -10
  286. package/dist/transform/read/relationship.d.ts.map +0 -1
  287. package/dist/transform/read/relationship.js +0 -64
  288. package/dist/transform/read/relationship.js.map +0 -1
  289. package/dist/transform/read/traverseFields.d.ts +0 -52
  290. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  291. package/dist/transform/read/traverseFields.js +0 -421
  292. package/dist/transform/read/traverseFields.js.map +0 -1
  293. package/dist/transform/write/array.d.ts +0 -26
  294. package/dist/transform/write/array.d.ts.map +0 -1
  295. package/dist/transform/write/array.js +0 -58
  296. package/dist/transform/write/array.js.map +0 -1
  297. package/dist/transform/write/blocks.d.ts +0 -25
  298. package/dist/transform/write/blocks.d.ts.map +0 -1
  299. package/dist/transform/write/blocks.js +0 -54
  300. package/dist/transform/write/blocks.js.map +0 -1
  301. package/dist/transform/write/index.d.ts +0 -13
  302. package/dist/transform/write/index.d.ts.map +0 -1
  303. package/dist/transform/write/index.js +0 -41
  304. package/dist/transform/write/index.js.map +0 -1
  305. package/dist/transform/write/numbers.d.ts +0 -8
  306. package/dist/transform/write/numbers.d.ts.map +0 -1
  307. package/dist/transform/write/numbers.js +0 -11
  308. package/dist/transform/write/numbers.js.map +0 -1
  309. package/dist/transform/write/relationships.d.ts +0 -10
  310. package/dist/transform/write/relationships.d.ts.map +0 -1
  311. package/dist/transform/write/relationships.js +0 -23
  312. package/dist/transform/write/relationships.js.map +0 -1
  313. package/dist/transform/write/selects.d.ts +0 -8
  314. package/dist/transform/write/selects.d.ts.map +0 -1
  315. package/dist/transform/write/selects.js +0 -20
  316. package/dist/transform/write/selects.js.map +0 -1
  317. package/dist/transform/write/texts.d.ts +0 -8
  318. package/dist/transform/write/texts.d.ts.map +0 -1
  319. package/dist/transform/write/texts.js +0 -11
  320. package/dist/transform/write/texts.js.map +0 -1
  321. package/dist/transform/write/traverseFields.d.ts +0 -50
  322. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  323. package/dist/transform/write/traverseFields.js +0 -428
  324. package/dist/transform/write/traverseFields.js.map +0 -1
  325. package/dist/transform/write/types.d.ts +0 -43
  326. package/dist/transform/write/types.d.ts.map +0 -1
  327. package/dist/transform/write/types.js +0 -3
  328. package/dist/transform/write/types.js.map +0 -1
  329. package/dist/update.d.ts +0 -3
  330. package/dist/update.d.ts.map +0 -1
  331. package/dist/update.js +0 -55
  332. package/dist/update.js.map +0 -1
  333. package/dist/updateGlobal.d.ts +0 -5
  334. package/dist/updateGlobal.d.ts.map +0 -1
  335. package/dist/updateGlobal.js +0 -25
  336. package/dist/updateGlobal.js.map +0 -1
  337. package/dist/updateGlobalVersion.d.ts +0 -5
  338. package/dist/updateGlobalVersion.d.ts.map +0 -1
  339. package/dist/updateGlobalVersion.js +0 -36
  340. package/dist/updateGlobalVersion.js.map +0 -1
  341. package/dist/updateVersion.d.ts +0 -5
  342. package/dist/updateVersion.d.ts.map +0 -1
  343. package/dist/updateVersion.js +0 -36
  344. package/dist/updateVersion.js.map +0 -1
  345. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  346. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  347. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  348. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  349. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  350. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  351. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  352. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  353. package/dist/upsertRow/index.d.ts +0 -4
  354. package/dist/upsertRow/index.d.ts.map +0 -1
  355. package/dist/upsertRow/index.js +0 -277
  356. package/dist/upsertRow/index.js.map +0 -1
  357. package/dist/upsertRow/insertArrays.d.ts +0 -13
  358. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  359. package/dist/upsertRow/insertArrays.js +0 -68
  360. package/dist/upsertRow/insertArrays.js.map +0 -1
  361. package/dist/upsertRow/types.d.ts +0 -27
  362. package/dist/upsertRow/types.d.ts.map +0 -1
  363. package/dist/upsertRow/types.js +0 -3
  364. package/dist/upsertRow/types.js.map +0 -1
  365. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  366. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  367. package/dist/utilities/appendPrefixToKeys.js +0 -6
  368. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  369. package/dist/utilities/createBlocksMap.d.ts +0 -5
  370. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  371. package/dist/utilities/createBlocksMap.js +0 -29
  372. package/dist/utilities/createBlocksMap.js.map +0 -1
  373. package/dist/utilities/createMigrationTable.d.ts +0 -3
  374. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  375. package/dist/utilities/createMigrationTable.js +0 -13
  376. package/dist/utilities/createMigrationTable.js.map +0 -1
  377. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  378. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  379. package/dist/utilities/createRelationshipMap.js +0 -19
  380. package/dist/utilities/createRelationshipMap.js.map +0 -1
  381. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  382. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  383. package/dist/utilities/hasLocalesTable.js +0 -11
  384. package/dist/utilities/hasLocalesTable.js.map +0 -1
  385. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  386. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  387. package/dist/utilities/isArrayOfRows.js +0 -5
  388. package/dist/utilities/isArrayOfRows.js.map +0 -1
  389. package/dist/utilities/migrationTableExists.d.ts +0 -3
  390. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  391. package/dist/utilities/migrationTableExists.js +0 -9
  392. package/dist/utilities/migrationTableExists.js.map +0 -1
  393. package/dist/utilities/parseError.d.ts +0 -5
  394. package/dist/utilities/parseError.d.ts.map +0 -1
  395. package/dist/utilities/parseError.js +0 -17
  396. package/dist/utilities/parseError.js.map +0 -1
  397. package/dist/utilities/pushDevSchema.d.ts +0 -9
  398. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  399. package/dist/utilities/pushDevSchema.js +0 -58
  400. package/dist/utilities/pushDevSchema.js.map +0 -1
  401. /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.d.ts +0 -0
  402. /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.js +0 -0
  403. /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.d.ts +0 -0
  404. /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.js +0 -0
  405. /package/dist/{queries/createJSONQuery → createJSONQuery}/index.d.ts +0 -0
  406. /package/dist/{queries/createJSONQuery → createJSONQuery}/index.js +0 -0
@@ -0,0 +1,57 @@
1
+ import { sql } from 'drizzle-orm';
2
+ import { fetchAndResave } from './fetchAndResave/index.js';
3
+ export const migrateRelationships = async ({ adapter, collectionSlug, db, debug, fields, globalSlug, isVersions, pathsToQuery, payload, req, tableName })=>{
4
+ if (pathsToQuery.size === 0) return;
5
+ let offset = 0;
6
+ let paginationResult;
7
+ const where = Array.from(pathsToQuery).reduce((statement, path, i)=>{
8
+ return statement += `
9
+ "${tableName}${adapter.relationshipsSuffix}"."path" LIKE '${path}'${pathsToQuery.size !== i + 1 ? ' OR' : ''}
10
+ `;
11
+ }, '');
12
+ while(typeof paginationResult === 'undefined' || paginationResult.rows.length > 0){
13
+ const paginationStatement = `SELECT DISTINCT parent_id FROM ${tableName}${adapter.relationshipsSuffix} WHERE
14
+ ${where} ORDER BY parent_id LIMIT 500 OFFSET ${offset * 500};
15
+ `;
16
+ paginationResult = await adapter.drizzle.execute(sql.raw(`${paginationStatement}`));
17
+ if (paginationResult.rows.length === 0) return;
18
+ offset += 1;
19
+ const statement = `SELECT * FROM ${tableName}${adapter.relationshipsSuffix} WHERE
20
+ (${where}) AND parent_id IN (${paginationResult.rows.map((row)=>row.parent_id).join(', ')});
21
+ `;
22
+ if (debug) {
23
+ payload.logger.info('FINDING ROWS TO MIGRATE');
24
+ payload.logger.info(statement);
25
+ }
26
+ const result = await adapter.drizzle.execute(sql.raw(`${statement}`));
27
+ const docsToResave = {};
28
+ result.rows.forEach((row)=>{
29
+ const parentID = row.parent_id;
30
+ if (typeof parentID === 'string' || typeof parentID === 'number') {
31
+ if (!docsToResave[parentID]) docsToResave[parentID] = [];
32
+ docsToResave[parentID].push(row);
33
+ }
34
+ });
35
+ await fetchAndResave({
36
+ adapter,
37
+ collectionSlug,
38
+ db,
39
+ debug,
40
+ docsToResave,
41
+ fields,
42
+ globalSlug,
43
+ isVersions,
44
+ payload,
45
+ req: req,
46
+ tableName
47
+ });
48
+ }
49
+ const deleteStatement = `DELETE FROM ${tableName}${adapter.relationshipsSuffix} WHERE ${where}`;
50
+ if (debug) {
51
+ payload.logger.info('DELETING ROWS');
52
+ payload.logger.info(deleteStatement);
53
+ }
54
+ await db.execute(sql.raw(`${deleteStatement}`));
55
+ };
56
+
57
+ //# sourceMappingURL=migrateRelationships.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/predefinedMigrations/v2-v3/migrateRelationships.ts"],"sourcesContent":["import type { TransactionPg } from '@payloadcms/drizzle/types'\nimport type { Field, Payload, PayloadRequest } from 'payload'\n\nimport { sql } from 'drizzle-orm'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { DocsToResave, PathsToQuery } from './types.js'\n\nimport { fetchAndResave } from './fetchAndResave/index.js'\n\ntype Args = {\n adapter: PostgresAdapter\n collectionSlug?: string\n db: TransactionPg\n debug: boolean\n fields: Field[]\n globalSlug?: string\n isVersions: boolean\n pathsToQuery: PathsToQuery\n payload: Payload\n req?: Partial<PayloadRequest>\n tableName: string\n}\n\nexport const migrateRelationships = async ({\n adapter,\n collectionSlug,\n db,\n debug,\n fields,\n globalSlug,\n isVersions,\n pathsToQuery,\n payload,\n req,\n tableName,\n}: Args) => {\n if (pathsToQuery.size === 0) return\n\n let offset = 0\n\n let paginationResult\n\n const where = Array.from(pathsToQuery).reduce((statement, path, i) => {\n return (statement += `\n\"${tableName}${adapter.relationshipsSuffix}\".\"path\" LIKE '${path}'${pathsToQuery.size !== i + 1 ? ' OR' : ''}\n`)\n }, '')\n\n while (typeof paginationResult === 'undefined' || paginationResult.rows.length > 0) {\n const paginationStatement = `SELECT DISTINCT parent_id FROM ${tableName}${adapter.relationshipsSuffix} WHERE\n ${where} ORDER BY parent_id LIMIT 500 OFFSET ${offset * 500};\n `\n\n paginationResult = await adapter.drizzle.execute(sql.raw(`${paginationStatement}`))\n\n if (paginationResult.rows.length === 0) return\n\n offset += 1\n\n const statement = `SELECT * FROM ${tableName}${adapter.relationshipsSuffix} WHERE\n (${where}) AND parent_id IN (${paginationResult.rows.map((row) => row.parent_id).join(', ')});\n`\n if (debug) {\n payload.logger.info('FINDING ROWS TO MIGRATE')\n payload.logger.info(statement)\n }\n\n const result = await adapter.drizzle.execute(sql.raw(`${statement}`))\n\n const docsToResave: DocsToResave = {}\n\n result.rows.forEach((row) => {\n const parentID = row.parent_id\n\n if (typeof parentID === 'string' || typeof parentID === 'number') {\n if (!docsToResave[parentID]) docsToResave[parentID] = []\n docsToResave[parentID].push(row)\n }\n })\n\n await fetchAndResave({\n adapter,\n collectionSlug,\n db,\n debug,\n docsToResave,\n fields,\n globalSlug,\n isVersions,\n payload,\n req: req as unknown as PayloadRequest,\n tableName,\n })\n }\n\n const deleteStatement = `DELETE FROM ${tableName}${adapter.relationshipsSuffix} WHERE ${where}`\n if (debug) {\n payload.logger.info('DELETING ROWS')\n payload.logger.info(deleteStatement)\n }\n await db.execute(sql.raw(`${deleteStatement}`))\n}\n"],"names":["sql","fetchAndResave","migrateRelationships","adapter","collectionSlug","db","debug","fields","globalSlug","isVersions","pathsToQuery","payload","req","tableName","size","offset","paginationResult","where","Array","from","reduce","statement","path","i","relationshipsSuffix","rows","length","paginationStatement","drizzle","execute","raw","map","row","parent_id","join","logger","info","result","docsToResave","forEach","parentID","push","deleteStatement"],"mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AAKjC,SAASC,cAAc,QAAQ,4BAA2B;AAgB1D,OAAO,MAAMC,uBAAuB,OAAO,EACzCC,OAAO,EACPC,cAAc,EACdC,EAAE,EACFC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,UAAU,EACVC,YAAY,EACZC,OAAO,EACPC,GAAG,EACHC,SAAS,EACJ;IACL,IAAIH,aAAaI,IAAI,KAAK,GAAG;IAE7B,IAAIC,SAAS;IAEb,IAAIC;IAEJ,MAAMC,QAAQC,MAAMC,IAAI,CAACT,cAAcU,MAAM,CAAC,CAACC,WAAWC,MAAMC;QAC9D,OAAQF,aAAa,CAAC;CACzB,EAAER,UAAU,EAAEV,QAAQqB,mBAAmB,C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E;YACAC;YACAC;YACAC;YACAgC;YACA/B;YACAC;YACAC;YACAE;YACAC,KAAKA;YACLC;QACF;IACF;IAEA,MAAM6B,kBAAkB,CAAC,YAAY,EAAE7B,UAAU,EAAEV,QAAQqB,mBAAmB,CAAC,OAAO,EAAEP,MAAM,CAAC;IAC/F,IAAIX,OAAO;QACTK,QAAQwB,MAAM,CAACC,IAAI,CAAC;QACpBzB,QAAQwB,MAAM,CAACC,IAAI,CAACM;IACtB;IACA,MAAMrC,GAAGwB,OAAO,CAAC7B,IAAI8B,GAAG,CAAC,CAAC,EAAEY,gBAAgB,CAAC;AAC/C,EAAC"}
@@ -0,0 +1,23 @@
1
+ import type { TransactionPg } from '@payloadcms/drizzle/types';
2
+ import type { Field, Payload } from 'payload';
3
+ import type { PostgresAdapter } from '../../types.js';
4
+ import type { PathsToQuery } from './types.js';
5
+ type Args = {
6
+ adapter: PostgresAdapter;
7
+ collectionSlug?: string;
8
+ columnPrefix: string;
9
+ db: TransactionPg;
10
+ disableNotNull: boolean;
11
+ fields: Field[];
12
+ globalSlug?: string;
13
+ isVersions: boolean;
14
+ newTableName: string;
15
+ parentTableName: string;
16
+ path: string;
17
+ pathsToQuery: PathsToQuery;
18
+ payload: Payload;
19
+ rootTableName: string;
20
+ };
21
+ export declare const traverseFields: (args: Args) => void;
22
+ export {};
23
+ //# sourceMappingURL=traverseFields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/predefinedMigrations/v2-v3/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAK7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,EAAE,EAAE,aAAa,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,SAAU,IAAI,SA0FxC,CAAA"}
@@ -0,0 +1,85 @@
1
+ import { tabHasName } from 'payload/shared';
2
+ import toSnakeCase from 'to-snake-case';
3
+ export const traverseFields = (args)=>{
4
+ args.fields.forEach((field)=>{
5
+ switch(field.type){
6
+ case 'group':
7
+ {
8
+ let newTableName = `${args.newTableName}_${toSnakeCase(field.name)}`;
9
+ if (field.localized && args.payload.config.localization) {
10
+ newTableName += args.adapter.localesSuffix;
11
+ }
12
+ return traverseFields({
13
+ ...args,
14
+ columnPrefix: `${args.columnPrefix}${toSnakeCase(field.name)}_`,
15
+ fields: field.fields,
16
+ newTableName,
17
+ path: `${args.path ? `${args.path}.` : ''}${field.name}`
18
+ });
19
+ }
20
+ case 'row':
21
+ case 'collapsible':
22
+ {
23
+ return traverseFields({
24
+ ...args,
25
+ fields: field.fields
26
+ });
27
+ }
28
+ case 'array':
29
+ {
30
+ const newTableName = args.adapter.tableNameMap.get(`${args.newTableName}_${toSnakeCase(field.name)}`);
31
+ return traverseFields({
32
+ ...args,
33
+ columnPrefix: '',
34
+ fields: field.fields,
35
+ newTableName,
36
+ parentTableName: newTableName,
37
+ path: `${args.path ? `${args.path}.` : ''}${field.name}.%`
38
+ });
39
+ }
40
+ case 'blocks':
41
+ {
42
+ return field.blocks.forEach((block)=>{
43
+ const newTableName = args.adapter.tableNameMap.get(`${args.rootTableName}_blocks_${toSnakeCase(block.slug)}`);
44
+ traverseFields({
45
+ ...args,
46
+ columnPrefix: '',
47
+ fields: block.fields,
48
+ newTableName,
49
+ parentTableName: newTableName,
50
+ path: `${args.path ? `${args.path}.` : ''}${field.name}.%`
51
+ });
52
+ });
53
+ }
54
+ case 'tabs':
55
+ {
56
+ return field.tabs.forEach((tab)=>{
57
+ if (tabHasName(tab)) {
58
+ args.columnPrefix = `${args.columnPrefix}_${toSnakeCase(tab.name)}_`;
59
+ args.path = `${args.path ? `${args.path}.` : ''}${tab.name}`;
60
+ args.newTableName = `${args.newTableName}_${toSnakeCase(tab.name)}`;
61
+ if (tab.localized && args.payload.config.localization) {
62
+ args.newTableName += args.adapter.localesSuffix;
63
+ }
64
+ }
65
+ traverseFields({
66
+ ...args,
67
+ fields: tab.fields
68
+ });
69
+ });
70
+ }
71
+ case 'relationship':
72
+ case 'upload':
73
+ {
74
+ if (typeof field.relationTo === 'string') {
75
+ if (field.type === 'upload' || !field.hasMany) {
76
+ args.pathsToQuery.add(`${args.path ? `${args.path}.` : ''}${field.name}`);
77
+ }
78
+ }
79
+ return null;
80
+ }
81
+ }
82
+ });
83
+ };
84
+
85
+ //# sourceMappingURL=traverseFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/predefinedMigrations/v2-v3/traverseFields.ts"],"sourcesContent":["import type { TransactionPg } from '@payloadcms/drizzle/types'\nimport type { Field, Payload } from 'payload'\n\nimport { tabHasName } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { PathsToQuery } from './types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n collectionSlug?: string\n columnPrefix: string\n db: TransactionPg\n disableNotNull: boolean\n fields: Field[]\n globalSlug?: string\n isVersions: boolean\n newTableName: string\n parentTableName: string\n path: string\n pathsToQuery: PathsToQuery\n payload: Payload\n rootTableName: string\n}\n\nexport const traverseFields = (args: Args) => {\n args.fields.forEach((field) => {\n switch (field.type) {\n case 'group': {\n let newTableName = `${args.newTableName}_${toSnakeCase(field.name)}`\n\n if (field.localized && args.payload.config.localization) {\n newTableName += args.adapter.localesSuffix\n }\n\n return traverseFields({\n ...args,\n columnPrefix: `${args.columnPrefix}${toSnakeCase(field.name)}_`,\n fields: field.fields,\n newTableName,\n path: `${args.path ? `${args.path}.` : ''}${field.name}`,\n })\n }\n\n case 'row':\n case 'collapsible': {\n return traverseFields({\n ...args,\n fields: field.fields,\n })\n }\n\n case 'array': {\n const newTableName = args.adapter.tableNameMap.get(\n `${args.newTableName}_${toSnakeCase(field.name)}`,\n )\n\n return traverseFields({\n ...args,\n columnPrefix: '',\n fields: field.fields,\n newTableName,\n parentTableName: newTableName,\n path: `${args.path ? `${args.path}.` : ''}${field.name}.%`,\n })\n }\n\n case 'blocks': {\n return field.blocks.forEach((block) => {\n const newTableName = args.adapter.tableNameMap.get(\n `${args.rootTableName}_blocks_${toSnakeCase(block.slug)}`,\n )\n\n traverseFields({\n ...args,\n columnPrefix: '',\n fields: block.fields,\n newTableName,\n parentTableName: newTableName,\n path: `${args.path ? `${args.path}.` : ''}${field.name}.%`,\n })\n })\n }\n\n case 'tabs': {\n return field.tabs.forEach((tab) => {\n if (tabHasName(tab)) {\n args.columnPrefix = `${args.columnPrefix}_${toSnakeCase(tab.name)}_`\n args.path = `${args.path ? `${args.path}.` : ''}${tab.name}`\n args.newTableName = `${args.newTableName}_${toSnakeCase(tab.name)}`\n\n if (tab.localized && args.payload.config.localization) {\n args.newTableName += args.adapter.localesSuffix\n }\n }\n\n traverseFields({\n ...args,\n fields: tab.fields,\n })\n })\n }\n\n case 'relationship':\n case 'upload': {\n if (typeof field.relationTo === 'string') {\n if (field.type === 'upload' || !field.hasMany) {\n args.pathsToQuery.add(`${args.path ? `${args.path}.` : ''}${field.name}`)\n }\n }\n\n return null\n }\n }\n })\n}\n"],"names":["tabHasName","toSnakeCase","traverseFields","args","fields","forEach","field","type","newTableName","name","localized","payload","config","localization","adapter","localesSuffix","columnPrefix","path","tableNameMap","get","parentTableName","blocks","block","rootTableName","slug","tabs","tab","relationTo","hasMany","pathsToQuery","add"],"mappings":"AAGA,SAASA,UAAU,QAAQ,iBAAgB;AAC3C,OAAOC,iBAAiB,gBAAe;AAsBvC,OAAO,MAAMC,iBAAiB,CAACC;IAC7BA,KAAKC,MAAM,CAACC,OAAO,CAAC,CAACC;QACnB,OAAQA,MAAMC,IAAI;YAChB,KAAK;gBAAS;oBACZ,IAAIC,eAAe,CAAC,EAAEL,KAAKK,YAAY,CAAC,CAAC,EAAEP,YAAYK,MAAMG,IAAI,EAAE,CAAC;oBAEpE,IAAIH,MAAMI,SAAS,IAAIP,KAAKQ,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;wBACvDL,gBAAgBL,KAAKW,OAAO,CAACC,aAAa;oBAC5C;oBAEA,OAAOb,eAAe;wBACpB,GAAGC,IAAI;wBACPa,cAAc,CAAC,EAAEb,KAAKa,YAAY,CAAC,EAAEf,YAAYK,MAAMG,IAAI,EAAE,CAAC,CAAC;wBAC/DL,QAAQE,MAAMF,MAAM;wBACpBI;wBACAS,MAAM,CAAC,EAAEd,KAAKc,IAAI,GAAG,CAAC,EAAEd,KAAKc,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,EAAEX,MAAMG,IAAI,CAAC,CAAC;oBAC1D;gBACF;YAEA,KAAK;YACL,KAAK;gBAAe;oBAClB,OAAOP,eAAe;wBACpB,GAAGC,IAAI;wBACPC,QAAQE,MAAMF,MAAM;oBACtB;gBACF;YAEA,KAAK;gBAAS;oBACZ,MAAMI,eAAeL,KAAKW,OAAO,CAACI,YAAY,CAACC,GAAG,CAChD,CAAC,EAAEhB,KAAKK,YAAY,CAAC,CAAC,EAAEP,YAAYK,MAAMG,IAAI,EAAE,CAAC;oBAGnD,OAAOP,eAAe;wBACpB,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,SAAS,IAAIP,KAAKQ,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;gCACrDV,KAAKK,YAAY,IAAIL,KAAKW,OAAO,CAACC,aAAa;4BACjD;wBACF;wBAEAb,eAAe;4BACb,GAAGC,IAAI;4BACPC,QAAQsB,IAAItB,MAAM;wBACpB;oBACF;gBACF;YAEA,KAAK;YACL,KAAK;gBAAU;oBACb,IAAI,OAAOE,MAAMqB,UAAU,KAAK,UAAU;wBACxC,IAAIrB,MAAMC,IAAI,KAAK,YAAY,CAACD,MAAMsB,OAAO,EAAE;4BAC7CzB,KAAK0B,YAAY,CAACC,GAAG,CAAC,CAAC,EAAE3B,KAAKc,IAAI,GAAG,CAAC,EAAEd,KAAKc,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,EAAEX,MAAMG,IAAI,CAAC,CAAC;wBAC1E;oBACF;oBAEA,OAAO;gBACT;QACF;IACF;AACF,EAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Set of all paths which should be moved
3
+ * This will be built up into one WHERE query
4
+ */
5
+ export type PathsToQuery = Set<string>;
6
+ export type DocsToResave = {
7
+ [id: number | string]: Record<string, unknown>[];
8
+ };
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/predefinedMigrations/v2-v3/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACjD,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Set of all paths which should be moved
3
+ * This will be built up into one WHERE query
4
+ */ export { };
5
+
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/predefinedMigrations/v2-v3/types.ts"],"sourcesContent":["/**\n * Set of all paths which should be moved\n * This will be built up into one WHERE query\n */\nexport type PathsToQuery = Set<string>\n\nexport type DocsToResave = {\n [id: number | string]: Record<string, unknown>[]\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAGD,WAEC"}
@@ -0,0 +1,3 @@
1
+ import type { RequireDrizzleKit } from '@payloadcms/drizzle/types';
2
+ export declare const requireDrizzleKit: RequireDrizzleKit;
3
+ //# sourceMappingURL=requireDrizzleKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requireDrizzleKit.d.ts","sourceRoot":"","sources":["../src/requireDrizzleKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,eAAO,MAAM,iBAAiB,EAAE,iBAAwD,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ export const requireDrizzleKit = ()=>require('drizzle-kit/payload');
4
+
5
+ //# sourceMappingURL=requireDrizzleKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/requireDrizzleKit.ts"],"sourcesContent":["import type { RequireDrizzleKit } from '@payloadcms/drizzle/types'\n\nimport { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\nexport const requireDrizzleKit: RequireDrizzleKit = () => require('drizzle-kit/payload')\n"],"names":["createRequire","require","url","requireDrizzleKit"],"mappings":"AAEA,SAASA,aAAa,QAAQ,SAAQ;AACtC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAC7C,OAAO,MAAMC,oBAAuC,IAAMF,QAAQ,uBAAsB"}
@@ -1,18 +1,22 @@
1
1
  import type { ForeignKeyBuilder, IndexBuilder, PgColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/pg-core';
2
- import type { Field } from 'payload/types';
2
+ import type { Field } from 'payload';
3
3
  import type { GenericColumns, PostgresAdapter } from '../types.js';
4
4
  export type BaseExtraConfig = Record<string, (cols: GenericColumns) => ForeignKeyBuilder | IndexBuilder | UniqueConstraintBuilder>;
5
+ export type RelationMap = Map<string, {
6
+ localized: boolean;
7
+ target: string;
8
+ type: 'many' | 'one';
9
+ }>;
5
10
  type Args = {
6
11
  adapter: PostgresAdapter;
7
12
  baseColumns?: Record<string, PgColumnBuilder>;
8
13
  baseExtraConfig?: BaseExtraConfig;
9
14
  buildNumbers?: boolean;
10
15
  buildRelationships?: boolean;
11
- buildTexts?: boolean;
12
16
  disableNotNull: boolean;
13
17
  disableUnique: boolean;
14
18
  fields: Field[];
15
- rootRelationsToBuild?: Map<string, string>;
19
+ rootRelationsToBuild?: RelationMap;
16
20
  rootRelationships?: Set<string>;
17
21
  rootTableIDColType?: string;
18
22
  rootTableName?: string;
@@ -23,8 +27,8 @@ type Args = {
23
27
  type Result = {
24
28
  hasManyNumberField: 'index' | boolean;
25
29
  hasManyTextField: 'index' | boolean;
26
- relationsToBuild: Map<string, string>;
30
+ relationsToBuild: RelationMap;
27
31
  };
28
- export declare const buildTable: ({ adapter, baseColumns, baseExtraConfig, buildNumbers, buildRelationships, buildTexts, disableNotNull, disableUnique, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, versions, }: Args) => Result;
32
+ export declare const buildTable: ({ adapter, baseColumns, baseExtraConfig, disableNotNull, disableUnique, fields, rootRelationsToBuild, rootRelationships, rootTableIDColType, rootTableName: incomingRootTableName, tableName, timestamps, versions, }: Args) => Result;
29
33
  export {};
30
34
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/schema/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAEf,uBAAuB,EACxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAe1C,OAAO,K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