@warlock.js/cascade 4.0.156 → 4.0.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (689) hide show
  1. package/package.json +4 -4
  2. package/cjs/context/database-data-source-context.d.ts +0 -29
  3. package/cjs/context/database-data-source-context.d.ts.map +0 -1
  4. package/cjs/context/database-data-source-context.js +0 -28
  5. package/cjs/context/database-data-source-context.js.map +0 -1
  6. package/cjs/context/database-transaction-context.d.ts +0 -35
  7. package/cjs/context/database-transaction-context.d.ts.map +0 -1
  8. package/cjs/context/database-transaction-context.js +0 -40
  9. package/cjs/context/database-transaction-context.js.map +0 -1
  10. package/cjs/contracts/database-driver.contract.d.ts +0 -450
  11. package/cjs/contracts/database-driver.contract.d.ts.map +0 -1
  12. package/cjs/contracts/database-id-generator.contract.d.ts +0 -109
  13. package/cjs/contracts/database-id-generator.contract.d.ts.map +0 -1
  14. package/cjs/contracts/database-remover.contract.d.ts +0 -104
  15. package/cjs/contracts/database-remover.contract.d.ts.map +0 -1
  16. package/cjs/contracts/database-restorer.contract.d.ts +0 -143
  17. package/cjs/contracts/database-restorer.contract.d.ts.map +0 -1
  18. package/cjs/contracts/database-writer.contract.d.ts +0 -119
  19. package/cjs/contracts/database-writer.contract.d.ts.map +0 -1
  20. package/cjs/contracts/driver-blueprint.contract.d.ts +0 -49
  21. package/cjs/contracts/driver-blueprint.contract.d.ts.map +0 -1
  22. package/cjs/contracts/index.d.ts +0 -10
  23. package/cjs/contracts/index.d.ts.map +0 -1
  24. package/cjs/contracts/migration-driver.contract.d.ts +0 -522
  25. package/cjs/contracts/migration-driver.contract.d.ts.map +0 -1
  26. package/cjs/contracts/query-builder.contract.d.ts +0 -1609
  27. package/cjs/contracts/query-builder.contract.d.ts.map +0 -1
  28. package/cjs/contracts/sync-adapter.contract.d.ts +0 -58
  29. package/cjs/contracts/sync-adapter.contract.d.ts.map +0 -1
  30. package/cjs/data-source/data-source-registry.d.ts +0 -108
  31. package/cjs/data-source/data-source-registry.d.ts.map +0 -1
  32. package/cjs/data-source/data-source-registry.js +0 -145
  33. package/cjs/data-source/data-source-registry.js.map +0 -1
  34. package/cjs/data-source/data-source.d.ts +0 -147
  35. package/cjs/data-source/data-source.d.ts.map +0 -1
  36. package/cjs/data-source/data-source.js +0 -83
  37. package/cjs/data-source/data-source.js.map +0 -1
  38. package/cjs/database-dirty-tracker.d.ts +0 -252
  39. package/cjs/database-dirty-tracker.d.ts.map +0 -1
  40. package/cjs/database-dirty-tracker.js +0 -386
  41. package/cjs/database-dirty-tracker.js.map +0 -1
  42. package/cjs/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
  43. package/cjs/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
  44. package/cjs/drivers/mongodb/mongodb-blueprint.js +0 -51
  45. package/cjs/drivers/mongodb/mongodb-blueprint.js.map +0 -1
  46. package/cjs/drivers/mongodb/mongodb-driver.d.ts +0 -324
  47. package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
  48. package/cjs/drivers/mongodb/mongodb-driver.js +0 -799
  49. package/cjs/drivers/mongodb/mongodb-driver.js.map +0 -1
  50. package/cjs/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
  51. package/cjs/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
  52. package/cjs/drivers/mongodb/mongodb-id-generator.js +0 -149
  53. package/cjs/drivers/mongodb/mongodb-id-generator.js.map +0 -1
  54. package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
  55. package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
  56. package/cjs/drivers/mongodb/mongodb-migration-driver.js +0 -666
  57. package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
  58. package/cjs/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
  59. package/cjs/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
  60. package/cjs/drivers/mongodb/mongodb-query-builder.js +0 -1988
  61. package/cjs/drivers/mongodb/mongodb-query-builder.js.map +0 -1
  62. package/cjs/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
  63. package/cjs/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
  64. package/cjs/drivers/mongodb/mongodb-query-operations.js +0 -270
  65. package/cjs/drivers/mongodb/mongodb-query-operations.js.map +0 -1
  66. package/cjs/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
  67. package/cjs/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
  68. package/cjs/drivers/mongodb/mongodb-query-parser.js +0 -1351
  69. package/cjs/drivers/mongodb/mongodb-query-parser.js.map +0 -1
  70. package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
  71. package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
  72. package/cjs/drivers/mongodb/mongodb-sync-adapter.js +0 -146
  73. package/cjs/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
  74. package/cjs/drivers/mongodb/types.d.ts +0 -43
  75. package/cjs/drivers/mongodb/types.d.ts.map +0 -1
  76. package/cjs/drivers/postgres/index.d.ts +0 -16
  77. package/cjs/drivers/postgres/index.d.ts.map +0 -1
  78. package/cjs/drivers/postgres/postgres-blueprint.d.ts +0 -64
  79. package/cjs/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
  80. package/cjs/drivers/postgres/postgres-blueprint.js +0 -121
  81. package/cjs/drivers/postgres/postgres-blueprint.js.map +0 -1
  82. package/cjs/drivers/postgres/postgres-dialect.d.ts +0 -136
  83. package/cjs/drivers/postgres/postgres-dialect.d.ts.map +0 -1
  84. package/cjs/drivers/postgres/postgres-dialect.js +0 -268
  85. package/cjs/drivers/postgres/postgres-dialect.js.map +0 -1
  86. package/cjs/drivers/postgres/postgres-driver.d.ts +0 -432
  87. package/cjs/drivers/postgres/postgres-driver.d.ts.map +0 -1
  88. package/cjs/drivers/postgres/postgres-driver.js +0 -965
  89. package/cjs/drivers/postgres/postgres-driver.js.map +0 -1
  90. package/cjs/drivers/postgres/postgres-migration-driver.d.ts +0 -397
  91. package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
  92. package/cjs/drivers/postgres/postgres-migration-driver.js +0 -900
  93. package/cjs/drivers/postgres/postgres-migration-driver.js.map +0 -1
  94. package/cjs/drivers/postgres/postgres-query-builder.d.ts +0 -254
  95. package/cjs/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
  96. package/cjs/drivers/postgres/postgres-query-builder.js +0 -933
  97. package/cjs/drivers/postgres/postgres-query-builder.js.map +0 -1
  98. package/cjs/drivers/postgres/postgres-query-parser.d.ts +0 -328
  99. package/cjs/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
  100. package/cjs/drivers/postgres/postgres-query-parser.js +0 -864
  101. package/cjs/drivers/postgres/postgres-query-parser.js.map +0 -1
  102. package/cjs/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
  103. package/cjs/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
  104. package/cjs/drivers/postgres/postgres-sql-serializer.js +0 -400
  105. package/cjs/drivers/postgres/postgres-sql-serializer.js.map +0 -1
  106. package/cjs/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
  107. package/cjs/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
  108. package/cjs/drivers/postgres/postgres-sync-adapter.js +0 -197
  109. package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
  110. package/cjs/drivers/postgres/types.d.ts +0 -142
  111. package/cjs/drivers/postgres/types.d.ts.map +0 -1
  112. package/cjs/drivers/sql/index.d.ts +0 -10
  113. package/cjs/drivers/sql/index.d.ts.map +0 -1
  114. package/cjs/drivers/sql/sql-dialect.contract.d.ts +0 -204
  115. package/cjs/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
  116. package/cjs/drivers/sql/sql-types.d.ts +0 -202
  117. package/cjs/drivers/sql/sql-types.d.ts.map +0 -1
  118. package/cjs/errors/missing-data-source.error.d.ts +0 -22
  119. package/cjs/errors/missing-data-source.error.d.ts.map +0 -1
  120. package/cjs/errors/missing-data-source.error.js +0 -29
  121. package/cjs/errors/missing-data-source.error.js.map +0 -1
  122. package/cjs/errors/transaction-rollback.error.d.ts +0 -20
  123. package/cjs/errors/transaction-rollback.error.d.ts.map +0 -1
  124. package/cjs/errors/transaction-rollback.error.js +0 -27
  125. package/cjs/errors/transaction-rollback.error.js.map +0 -1
  126. package/cjs/events/model-events.d.ts +0 -231
  127. package/cjs/events/model-events.d.ts.map +0 -1
  128. package/cjs/events/model-events.js +0 -259
  129. package/cjs/events/model-events.js.map +0 -1
  130. package/cjs/expressions/aggregate-expressions.d.ts +0 -215
  131. package/cjs/expressions/aggregate-expressions.d.ts.map +0 -1
  132. package/cjs/expressions/aggregate-expressions.js +0 -221
  133. package/cjs/expressions/aggregate-expressions.js.map +0 -1
  134. package/cjs/expressions/index.d.ts +0 -2
  135. package/cjs/expressions/index.d.ts.map +0 -1
  136. package/cjs/index.d.ts +0 -45
  137. package/cjs/index.d.ts.map +0 -1
  138. package/cjs/index.js +0 -1
  139. package/cjs/index.js.map +0 -1
  140. package/cjs/migration/column-builder.d.ts +0 -417
  141. package/cjs/migration/column-builder.d.ts.map +0 -1
  142. package/cjs/migration/column-builder.js +0 -586
  143. package/cjs/migration/column-builder.js.map +0 -1
  144. package/cjs/migration/column-helpers.d.ts +0 -275
  145. package/cjs/migration/column-helpers.d.ts.map +0 -1
  146. package/cjs/migration/column-helpers.js +0 -389
  147. package/cjs/migration/column-helpers.js.map +0 -1
  148. package/cjs/migration/foreign-key-builder.d.ts +0 -103
  149. package/cjs/migration/foreign-key-builder.d.ts.map +0 -1
  150. package/cjs/migration/foreign-key-builder.js +0 -121
  151. package/cjs/migration/foreign-key-builder.js.map +0 -1
  152. package/cjs/migration/index.d.ts +0 -7
  153. package/cjs/migration/index.d.ts.map +0 -1
  154. package/cjs/migration/migration-runner.d.ts +0 -278
  155. package/cjs/migration/migration-runner.d.ts.map +0 -1
  156. package/cjs/migration/migration-runner.js +0 -815
  157. package/cjs/migration/migration-runner.js.map +0 -1
  158. package/cjs/migration/migration.d.ts +0 -1992
  159. package/cjs/migration/migration.d.ts.map +0 -1
  160. package/cjs/migration/migration.js +0 -2162
  161. package/cjs/migration/migration.js.map +0 -1
  162. package/cjs/migration/sql-grammar.d.ts +0 -61
  163. package/cjs/migration/sql-grammar.d.ts.map +0 -1
  164. package/cjs/migration/sql-grammar.js +0 -164
  165. package/cjs/migration/sql-grammar.js.map +0 -1
  166. package/cjs/migration/sql-serializer.d.ts +0 -22
  167. package/cjs/migration/sql-serializer.d.ts.map +0 -1
  168. package/cjs/migration/sql-serializer.js +0 -26
  169. package/cjs/migration/sql-serializer.js.map +0 -1
  170. package/cjs/migration/types.d.ts +0 -155
  171. package/cjs/migration/types.d.ts.map +0 -1
  172. package/cjs/model/methods/accessor-methods.d.ts +0 -13
  173. package/cjs/model/methods/accessor-methods.d.ts.map +0 -1
  174. package/cjs/model/methods/accessor-methods.js +0 -51
  175. package/cjs/model/methods/accessor-methods.js.map +0 -1
  176. package/cjs/model/methods/delete-methods.d.ts +0 -10
  177. package/cjs/model/methods/delete-methods.d.ts.map +0 -1
  178. package/cjs/model/methods/delete-methods.js +0 -10
  179. package/cjs/model/methods/delete-methods.js.map +0 -1
  180. package/cjs/model/methods/dirty-methods.d.ts +0 -10
  181. package/cjs/model/methods/dirty-methods.d.ts.map +0 -1
  182. package/cjs/model/methods/dirty-methods.js +0 -15
  183. package/cjs/model/methods/dirty-methods.js.map +0 -1
  184. package/cjs/model/methods/hydration-methods.d.ts +0 -10
  185. package/cjs/model/methods/hydration-methods.d.ts.map +0 -1
  186. package/cjs/model/methods/hydration-methods.js +0 -57
  187. package/cjs/model/methods/hydration-methods.js.map +0 -1
  188. package/cjs/model/methods/instance-event-methods.d.ts +0 -7
  189. package/cjs/model/methods/instance-event-methods.d.ts.map +0 -1
  190. package/cjs/model/methods/instance-event-methods.js +0 -15
  191. package/cjs/model/methods/instance-event-methods.js.map +0 -1
  192. package/cjs/model/methods/meta-methods.d.ts +0 -7
  193. package/cjs/model/methods/meta-methods.d.ts.map +0 -1
  194. package/cjs/model/methods/meta-methods.js +0 -78
  195. package/cjs/model/methods/meta-methods.js.map +0 -1
  196. package/cjs/model/methods/query-methods.d.ts +0 -24
  197. package/cjs/model/methods/query-methods.d.ts.map +0 -1
  198. package/cjs/model/methods/query-methods.js +0 -161
  199. package/cjs/model/methods/query-methods.js.map +0 -1
  200. package/cjs/model/methods/restore-methods.d.ts +0 -10
  201. package/cjs/model/methods/restore-methods.d.ts.map +0 -1
  202. package/cjs/model/methods/restore-methods.js +0 -13
  203. package/cjs/model/methods/restore-methods.js.map +0 -1
  204. package/cjs/model/methods/scope-methods.d.ts +0 -7
  205. package/cjs/model/methods/scope-methods.d.ts.map +0 -1
  206. package/cjs/model/methods/scope-methods.js +0 -15
  207. package/cjs/model/methods/scope-methods.js.map +0 -1
  208. package/cjs/model/methods/serialization-methods.d.ts +0 -3
  209. package/cjs/model/methods/serialization-methods.d.ts.map +0 -1
  210. package/cjs/model/methods/serialization-methods.js +0 -27
  211. package/cjs/model/methods/serialization-methods.js.map +0 -1
  212. package/cjs/model/methods/static-event-methods.d.ts +0 -9
  213. package/cjs/model/methods/static-event-methods.d.ts.map +0 -1
  214. package/cjs/model/methods/static-event-methods.js +0 -29
  215. package/cjs/model/methods/static-event-methods.js.map +0 -1
  216. package/cjs/model/methods/write-methods.d.ts +0 -10
  217. package/cjs/model/methods/write-methods.d.ts.map +0 -1
  218. package/cjs/model/methods/write-methods.js +0 -52
  219. package/cjs/model/methods/write-methods.js.map +0 -1
  220. package/cjs/model/model.d.ts +0 -1650
  221. package/cjs/model/model.d.ts.map +0 -1
  222. package/cjs/model/model.js +0 -1657
  223. package/cjs/model/model.js.map +0 -1
  224. package/cjs/model/model.types.d.ts +0 -44
  225. package/cjs/model/model.types.d.ts.map +0 -1
  226. package/cjs/model/register-model.d.ts +0 -81
  227. package/cjs/model/register-model.d.ts.map +0 -1
  228. package/cjs/model/register-model.js +0 -94
  229. package/cjs/model/register-model.js.map +0 -1
  230. package/cjs/query-builder/query-builder.d.ts +0 -556
  231. package/cjs/query-builder/query-builder.d.ts.map +0 -1
  232. package/cjs/query-builder/query-builder.js +0 -1070
  233. package/cjs/query-builder/query-builder.js.map +0 -1
  234. package/cjs/relations/helpers.d.ts +0 -156
  235. package/cjs/relations/helpers.d.ts.map +0 -1
  236. package/cjs/relations/helpers.js +0 -201
  237. package/cjs/relations/helpers.js.map +0 -1
  238. package/cjs/relations/index.d.ts +0 -35
  239. package/cjs/relations/index.d.ts.map +0 -1
  240. package/cjs/relations/pivot-operations.d.ts +0 -160
  241. package/cjs/relations/pivot-operations.d.ts.map +0 -1
  242. package/cjs/relations/pivot-operations.js +0 -293
  243. package/cjs/relations/pivot-operations.js.map +0 -1
  244. package/cjs/relations/relation-hydrator.d.ts +0 -68
  245. package/cjs/relations/relation-hydrator.d.ts.map +0 -1
  246. package/cjs/relations/relation-hydrator.js +0 -81
  247. package/cjs/relations/relation-hydrator.js.map +0 -1
  248. package/cjs/relations/relation-loader.d.ts +0 -194
  249. package/cjs/relations/relation-loader.d.ts.map +0 -1
  250. package/cjs/relations/relation-loader.js +0 -466
  251. package/cjs/relations/relation-loader.js.map +0 -1
  252. package/cjs/relations/types.d.ts +0 -306
  253. package/cjs/relations/types.d.ts.map +0 -1
  254. package/cjs/remover/database-remover.d.ts +0 -100
  255. package/cjs/remover/database-remover.d.ts.map +0 -1
  256. package/cjs/remover/database-remover.js +0 -214
  257. package/cjs/remover/database-remover.js.map +0 -1
  258. package/cjs/restorer/database-restorer.d.ts +0 -131
  259. package/cjs/restorer/database-restorer.d.ts.map +0 -1
  260. package/cjs/restorer/database-restorer.js +0 -434
  261. package/cjs/restorer/database-restorer.js.map +0 -1
  262. package/cjs/sql-database-dirty-tracker.d.ts +0 -13
  263. package/cjs/sql-database-dirty-tracker.d.ts.map +0 -1
  264. package/cjs/sql-database-dirty-tracker.js +0 -14
  265. package/cjs/sql-database-dirty-tracker.js.map +0 -1
  266. package/cjs/sync/index.d.ts +0 -12
  267. package/cjs/sync/index.d.ts.map +0 -1
  268. package/cjs/sync/model-events.d.ts +0 -62
  269. package/cjs/sync/model-events.d.ts.map +0 -1
  270. package/cjs/sync/model-events.js +0 -49
  271. package/cjs/sync/model-events.js.map +0 -1
  272. package/cjs/sync/model-sync-operation.d.ts +0 -163
  273. package/cjs/sync/model-sync-operation.d.ts.map +0 -1
  274. package/cjs/sync/model-sync-operation.js +0 -292
  275. package/cjs/sync/model-sync-operation.js.map +0 -1
  276. package/cjs/sync/model-sync.d.ts +0 -130
  277. package/cjs/sync/model-sync.d.ts.map +0 -1
  278. package/cjs/sync/model-sync.js +0 -178
  279. package/cjs/sync/model-sync.js.map +0 -1
  280. package/cjs/sync/sync-context.d.ts +0 -70
  281. package/cjs/sync/sync-context.d.ts.map +0 -1
  282. package/cjs/sync/sync-context.js +0 -101
  283. package/cjs/sync/sync-context.js.map +0 -1
  284. package/cjs/sync/sync-manager.d.ts +0 -213
  285. package/cjs/sync/sync-manager.d.ts.map +0 -1
  286. package/cjs/sync/sync-manager.js +0 -689
  287. package/cjs/sync/sync-manager.js.map +0 -1
  288. package/cjs/sync/types.d.ts +0 -289
  289. package/cjs/sync/types.d.ts.map +0 -1
  290. package/cjs/test-migrations/test-enhanced-features.migration.d.ts +0 -15
  291. package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
  292. package/cjs/types.d.ts +0 -371
  293. package/cjs/types.d.ts.map +0 -1
  294. package/cjs/utils/connect-to-database.d.ts +0 -300
  295. package/cjs/utils/connect-to-database.d.ts.map +0 -1
  296. package/cjs/utils/connect-to-database.js +0 -128
  297. package/cjs/utils/connect-to-database.js.map +0 -1
  298. package/cjs/utils/database-writer.utils.d.ts +0 -15
  299. package/cjs/utils/database-writer.utils.d.ts.map +0 -1
  300. package/cjs/utils/database-writer.utils.js +0 -14
  301. package/cjs/utils/database-writer.utils.js.map +0 -1
  302. package/cjs/utils/define-model.js +0 -100
  303. package/cjs/utils/define-model.js.map +0 -1
  304. package/cjs/utils/is-valid-date-value.d.ts +0 -5
  305. package/cjs/utils/is-valid-date-value.d.ts.map +0 -1
  306. package/cjs/utils/is-valid-date-value.js +0 -25
  307. package/cjs/utils/is-valid-date-value.js.map +0 -1
  308. package/cjs/utils/once-connected.d.ts +0 -146
  309. package/cjs/utils/once-connected.d.ts.map +0 -1
  310. package/cjs/utils/once-connected.js +0 -251
  311. package/cjs/utils/once-connected.js.map +0 -1
  312. package/cjs/validation/database-seal-plugins.d.ts +0 -12
  313. package/cjs/validation/database-seal-plugins.d.ts.map +0 -1
  314. package/cjs/validation/database-seal-plugins.js +0 -1
  315. package/cjs/validation/database-seal-plugins.js.map +0 -1
  316. package/cjs/validation/database-writer-validation-error.d.ts +0 -97
  317. package/cjs/validation/database-writer-validation-error.d.ts.map +0 -1
  318. package/cjs/validation/database-writer-validation-error.js +0 -160
  319. package/cjs/validation/database-writer-validation-error.js.map +0 -1
  320. package/cjs/validation/index.d.ts +0 -3
  321. package/cjs/validation/index.d.ts.map +0 -1
  322. package/cjs/validation/mutators/embed-mutator.d.ts +0 -9
  323. package/cjs/validation/mutators/embed-mutator.d.ts.map +0 -1
  324. package/cjs/validation/mutators/embed-mutator.js +0 -33
  325. package/cjs/validation/mutators/embed-mutator.js.map +0 -1
  326. package/cjs/validation/plugins/embed-validator-plugin.d.ts +0 -24
  327. package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
  328. package/cjs/validation/plugins/embed-validator-plugin.js +0 -18
  329. package/cjs/validation/plugins/embed-validator-plugin.js.map +0 -1
  330. package/cjs/validation/rules/database-model-rule.d.ts +0 -7
  331. package/cjs/validation/rules/database-model-rule.d.ts.map +0 -1
  332. package/cjs/validation/rules/database-model-rule.js +0 -27
  333. package/cjs/validation/rules/database-model-rule.js.map +0 -1
  334. package/cjs/validation/transformers/embed-model-transformer.d.ts +0 -3
  335. package/cjs/validation/transformers/embed-model-transformer.d.ts.map +0 -1
  336. package/cjs/validation/transformers/embed-model-transformer.js +0 -18
  337. package/cjs/validation/transformers/embed-model-transformer.js.map +0 -1
  338. package/cjs/validation/validators/embed-validator.d.ts +0 -21
  339. package/cjs/validation/validators/embed-validator.d.ts.map +0 -1
  340. package/cjs/validation/validators/embed-validator.js +0 -43
  341. package/cjs/validation/validators/embed-validator.js.map +0 -1
  342. package/cjs/writer/database-writer.d.ts +0 -181
  343. package/cjs/writer/database-writer.d.ts.map +0 -1
  344. package/cjs/writer/database-writer.js +0 -407
  345. package/cjs/writer/database-writer.js.map +0 -1
  346. package/esm/context/database-data-source-context.d.ts +0 -29
  347. package/esm/context/database-data-source-context.d.ts.map +0 -1
  348. package/esm/context/database-data-source-context.js +0 -28
  349. package/esm/context/database-data-source-context.js.map +0 -1
  350. package/esm/context/database-transaction-context.d.ts +0 -35
  351. package/esm/context/database-transaction-context.d.ts.map +0 -1
  352. package/esm/context/database-transaction-context.js +0 -40
  353. package/esm/context/database-transaction-context.js.map +0 -1
  354. package/esm/contracts/database-driver.contract.d.ts +0 -450
  355. package/esm/contracts/database-driver.contract.d.ts.map +0 -1
  356. package/esm/contracts/database-id-generator.contract.d.ts +0 -109
  357. package/esm/contracts/database-id-generator.contract.d.ts.map +0 -1
  358. package/esm/contracts/database-remover.contract.d.ts +0 -104
  359. package/esm/contracts/database-remover.contract.d.ts.map +0 -1
  360. package/esm/contracts/database-restorer.contract.d.ts +0 -143
  361. package/esm/contracts/database-restorer.contract.d.ts.map +0 -1
  362. package/esm/contracts/database-writer.contract.d.ts +0 -119
  363. package/esm/contracts/database-writer.contract.d.ts.map +0 -1
  364. package/esm/contracts/driver-blueprint.contract.d.ts +0 -49
  365. package/esm/contracts/driver-blueprint.contract.d.ts.map +0 -1
  366. package/esm/contracts/index.d.ts +0 -10
  367. package/esm/contracts/index.d.ts.map +0 -1
  368. package/esm/contracts/migration-driver.contract.d.ts +0 -522
  369. package/esm/contracts/migration-driver.contract.d.ts.map +0 -1
  370. package/esm/contracts/query-builder.contract.d.ts +0 -1609
  371. package/esm/contracts/query-builder.contract.d.ts.map +0 -1
  372. package/esm/contracts/sync-adapter.contract.d.ts +0 -58
  373. package/esm/contracts/sync-adapter.contract.d.ts.map +0 -1
  374. package/esm/data-source/data-source-registry.d.ts +0 -108
  375. package/esm/data-source/data-source-registry.d.ts.map +0 -1
  376. package/esm/data-source/data-source-registry.js +0 -145
  377. package/esm/data-source/data-source-registry.js.map +0 -1
  378. package/esm/data-source/data-source.d.ts +0 -147
  379. package/esm/data-source/data-source.d.ts.map +0 -1
  380. package/esm/data-source/data-source.js +0 -83
  381. package/esm/data-source/data-source.js.map +0 -1
  382. package/esm/database-dirty-tracker.d.ts +0 -252
  383. package/esm/database-dirty-tracker.d.ts.map +0 -1
  384. package/esm/database-dirty-tracker.js +0 -386
  385. package/esm/database-dirty-tracker.js.map +0 -1
  386. package/esm/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
  387. package/esm/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
  388. package/esm/drivers/mongodb/mongodb-blueprint.js +0 -51
  389. package/esm/drivers/mongodb/mongodb-blueprint.js.map +0 -1
  390. package/esm/drivers/mongodb/mongodb-driver.d.ts +0 -324
  391. package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
  392. package/esm/drivers/mongodb/mongodb-driver.js +0 -799
  393. package/esm/drivers/mongodb/mongodb-driver.js.map +0 -1
  394. package/esm/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
  395. package/esm/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
  396. package/esm/drivers/mongodb/mongodb-id-generator.js +0 -149
  397. package/esm/drivers/mongodb/mongodb-id-generator.js.map +0 -1
  398. package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
  399. package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
  400. package/esm/drivers/mongodb/mongodb-migration-driver.js +0 -666
  401. package/esm/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
  402. package/esm/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
  403. package/esm/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
  404. package/esm/drivers/mongodb/mongodb-query-builder.js +0 -1988
  405. package/esm/drivers/mongodb/mongodb-query-builder.js.map +0 -1
  406. package/esm/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
  407. package/esm/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
  408. package/esm/drivers/mongodb/mongodb-query-operations.js +0 -270
  409. package/esm/drivers/mongodb/mongodb-query-operations.js.map +0 -1
  410. package/esm/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
  411. package/esm/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
  412. package/esm/drivers/mongodb/mongodb-query-parser.js +0 -1351
  413. package/esm/drivers/mongodb/mongodb-query-parser.js.map +0 -1
  414. package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
  415. package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
  416. package/esm/drivers/mongodb/mongodb-sync-adapter.js +0 -146
  417. package/esm/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
  418. package/esm/drivers/mongodb/types.d.ts +0 -43
  419. package/esm/drivers/mongodb/types.d.ts.map +0 -1
  420. package/esm/drivers/postgres/index.d.ts +0 -16
  421. package/esm/drivers/postgres/index.d.ts.map +0 -1
  422. package/esm/drivers/postgres/postgres-blueprint.d.ts +0 -64
  423. package/esm/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
  424. package/esm/drivers/postgres/postgres-blueprint.js +0 -121
  425. package/esm/drivers/postgres/postgres-blueprint.js.map +0 -1
  426. package/esm/drivers/postgres/postgres-dialect.d.ts +0 -136
  427. package/esm/drivers/postgres/postgres-dialect.d.ts.map +0 -1
  428. package/esm/drivers/postgres/postgres-dialect.js +0 -268
  429. package/esm/drivers/postgres/postgres-dialect.js.map +0 -1
  430. package/esm/drivers/postgres/postgres-driver.d.ts +0 -432
  431. package/esm/drivers/postgres/postgres-driver.d.ts.map +0 -1
  432. package/esm/drivers/postgres/postgres-driver.js +0 -965
  433. package/esm/drivers/postgres/postgres-driver.js.map +0 -1
  434. package/esm/drivers/postgres/postgres-migration-driver.d.ts +0 -397
  435. package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
  436. package/esm/drivers/postgres/postgres-migration-driver.js +0 -900
  437. package/esm/drivers/postgres/postgres-migration-driver.js.map +0 -1
  438. package/esm/drivers/postgres/postgres-query-builder.d.ts +0 -254
  439. package/esm/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
  440. package/esm/drivers/postgres/postgres-query-builder.js +0 -933
  441. package/esm/drivers/postgres/postgres-query-builder.js.map +0 -1
  442. package/esm/drivers/postgres/postgres-query-parser.d.ts +0 -328
  443. package/esm/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
  444. package/esm/drivers/postgres/postgres-query-parser.js +0 -864
  445. package/esm/drivers/postgres/postgres-query-parser.js.map +0 -1
  446. package/esm/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
  447. package/esm/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
  448. package/esm/drivers/postgres/postgres-sql-serializer.js +0 -400
  449. package/esm/drivers/postgres/postgres-sql-serializer.js.map +0 -1
  450. package/esm/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
  451. package/esm/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
  452. package/esm/drivers/postgres/postgres-sync-adapter.js +0 -197
  453. package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
  454. package/esm/drivers/postgres/types.d.ts +0 -142
  455. package/esm/drivers/postgres/types.d.ts.map +0 -1
  456. package/esm/drivers/sql/index.d.ts +0 -10
  457. package/esm/drivers/sql/index.d.ts.map +0 -1
  458. package/esm/drivers/sql/sql-dialect.contract.d.ts +0 -204
  459. package/esm/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
  460. package/esm/drivers/sql/sql-types.d.ts +0 -202
  461. package/esm/drivers/sql/sql-types.d.ts.map +0 -1
  462. package/esm/errors/missing-data-source.error.d.ts +0 -22
  463. package/esm/errors/missing-data-source.error.d.ts.map +0 -1
  464. package/esm/errors/missing-data-source.error.js +0 -29
  465. package/esm/errors/missing-data-source.error.js.map +0 -1
  466. package/esm/errors/transaction-rollback.error.d.ts +0 -20
  467. package/esm/errors/transaction-rollback.error.d.ts.map +0 -1
  468. package/esm/errors/transaction-rollback.error.js +0 -27
  469. package/esm/errors/transaction-rollback.error.js.map +0 -1
  470. package/esm/events/model-events.d.ts +0 -231
  471. package/esm/events/model-events.d.ts.map +0 -1
  472. package/esm/events/model-events.js +0 -259
  473. package/esm/events/model-events.js.map +0 -1
  474. package/esm/expressions/aggregate-expressions.d.ts +0 -215
  475. package/esm/expressions/aggregate-expressions.d.ts.map +0 -1
  476. package/esm/expressions/aggregate-expressions.js +0 -221
  477. package/esm/expressions/aggregate-expressions.js.map +0 -1
  478. package/esm/expressions/index.d.ts +0 -2
  479. package/esm/expressions/index.d.ts.map +0 -1
  480. package/esm/index.d.ts +0 -45
  481. package/esm/index.d.ts.map +0 -1
  482. package/esm/index.js +0 -1
  483. package/esm/index.js.map +0 -1
  484. package/esm/migration/column-builder.d.ts +0 -417
  485. package/esm/migration/column-builder.d.ts.map +0 -1
  486. package/esm/migration/column-builder.js +0 -586
  487. package/esm/migration/column-builder.js.map +0 -1
  488. package/esm/migration/column-helpers.d.ts +0 -275
  489. package/esm/migration/column-helpers.d.ts.map +0 -1
  490. package/esm/migration/column-helpers.js +0 -389
  491. package/esm/migration/column-helpers.js.map +0 -1
  492. package/esm/migration/foreign-key-builder.d.ts +0 -103
  493. package/esm/migration/foreign-key-builder.d.ts.map +0 -1
  494. package/esm/migration/foreign-key-builder.js +0 -121
  495. package/esm/migration/foreign-key-builder.js.map +0 -1
  496. package/esm/migration/index.d.ts +0 -7
  497. package/esm/migration/index.d.ts.map +0 -1
  498. package/esm/migration/migration-runner.d.ts +0 -278
  499. package/esm/migration/migration-runner.d.ts.map +0 -1
  500. package/esm/migration/migration-runner.js +0 -815
  501. package/esm/migration/migration-runner.js.map +0 -1
  502. package/esm/migration/migration.d.ts +0 -1992
  503. package/esm/migration/migration.d.ts.map +0 -1
  504. package/esm/migration/migration.js +0 -2162
  505. package/esm/migration/migration.js.map +0 -1
  506. package/esm/migration/sql-grammar.d.ts +0 -61
  507. package/esm/migration/sql-grammar.d.ts.map +0 -1
  508. package/esm/migration/sql-grammar.js +0 -164
  509. package/esm/migration/sql-grammar.js.map +0 -1
  510. package/esm/migration/sql-serializer.d.ts +0 -22
  511. package/esm/migration/sql-serializer.d.ts.map +0 -1
  512. package/esm/migration/sql-serializer.js +0 -26
  513. package/esm/migration/sql-serializer.js.map +0 -1
  514. package/esm/migration/types.d.ts +0 -155
  515. package/esm/migration/types.d.ts.map +0 -1
  516. package/esm/model/methods/accessor-methods.d.ts +0 -13
  517. package/esm/model/methods/accessor-methods.d.ts.map +0 -1
  518. package/esm/model/methods/accessor-methods.js +0 -51
  519. package/esm/model/methods/accessor-methods.js.map +0 -1
  520. package/esm/model/methods/delete-methods.d.ts +0 -10
  521. package/esm/model/methods/delete-methods.d.ts.map +0 -1
  522. package/esm/model/methods/delete-methods.js +0 -10
  523. package/esm/model/methods/delete-methods.js.map +0 -1
  524. package/esm/model/methods/dirty-methods.d.ts +0 -10
  525. package/esm/model/methods/dirty-methods.d.ts.map +0 -1
  526. package/esm/model/methods/dirty-methods.js +0 -15
  527. package/esm/model/methods/dirty-methods.js.map +0 -1
  528. package/esm/model/methods/hydration-methods.d.ts +0 -10
  529. package/esm/model/methods/hydration-methods.d.ts.map +0 -1
  530. package/esm/model/methods/hydration-methods.js +0 -57
  531. package/esm/model/methods/hydration-methods.js.map +0 -1
  532. package/esm/model/methods/instance-event-methods.d.ts +0 -7
  533. package/esm/model/methods/instance-event-methods.d.ts.map +0 -1
  534. package/esm/model/methods/instance-event-methods.js +0 -15
  535. package/esm/model/methods/instance-event-methods.js.map +0 -1
  536. package/esm/model/methods/meta-methods.d.ts +0 -7
  537. package/esm/model/methods/meta-methods.d.ts.map +0 -1
  538. package/esm/model/methods/meta-methods.js +0 -78
  539. package/esm/model/methods/meta-methods.js.map +0 -1
  540. package/esm/model/methods/query-methods.d.ts +0 -24
  541. package/esm/model/methods/query-methods.d.ts.map +0 -1
  542. package/esm/model/methods/query-methods.js +0 -161
  543. package/esm/model/methods/query-methods.js.map +0 -1
  544. package/esm/model/methods/restore-methods.d.ts +0 -10
  545. package/esm/model/methods/restore-methods.d.ts.map +0 -1
  546. package/esm/model/methods/restore-methods.js +0 -13
  547. package/esm/model/methods/restore-methods.js.map +0 -1
  548. package/esm/model/methods/scope-methods.d.ts +0 -7
  549. package/esm/model/methods/scope-methods.d.ts.map +0 -1
  550. package/esm/model/methods/scope-methods.js +0 -15
  551. package/esm/model/methods/scope-methods.js.map +0 -1
  552. package/esm/model/methods/serialization-methods.d.ts +0 -3
  553. package/esm/model/methods/serialization-methods.d.ts.map +0 -1
  554. package/esm/model/methods/serialization-methods.js +0 -27
  555. package/esm/model/methods/serialization-methods.js.map +0 -1
  556. package/esm/model/methods/static-event-methods.d.ts +0 -9
  557. package/esm/model/methods/static-event-methods.d.ts.map +0 -1
  558. package/esm/model/methods/static-event-methods.js +0 -29
  559. package/esm/model/methods/static-event-methods.js.map +0 -1
  560. package/esm/model/methods/write-methods.d.ts +0 -10
  561. package/esm/model/methods/write-methods.d.ts.map +0 -1
  562. package/esm/model/methods/write-methods.js +0 -52
  563. package/esm/model/methods/write-methods.js.map +0 -1
  564. package/esm/model/model.d.ts +0 -1650
  565. package/esm/model/model.d.ts.map +0 -1
  566. package/esm/model/model.js +0 -1657
  567. package/esm/model/model.js.map +0 -1
  568. package/esm/model/model.types.d.ts +0 -44
  569. package/esm/model/model.types.d.ts.map +0 -1
  570. package/esm/model/register-model.d.ts +0 -81
  571. package/esm/model/register-model.d.ts.map +0 -1
  572. package/esm/model/register-model.js +0 -94
  573. package/esm/model/register-model.js.map +0 -1
  574. package/esm/query-builder/query-builder.d.ts +0 -556
  575. package/esm/query-builder/query-builder.d.ts.map +0 -1
  576. package/esm/query-builder/query-builder.js +0 -1070
  577. package/esm/query-builder/query-builder.js.map +0 -1
  578. package/esm/relations/helpers.d.ts +0 -156
  579. package/esm/relations/helpers.d.ts.map +0 -1
  580. package/esm/relations/helpers.js +0 -201
  581. package/esm/relations/helpers.js.map +0 -1
  582. package/esm/relations/index.d.ts +0 -35
  583. package/esm/relations/index.d.ts.map +0 -1
  584. package/esm/relations/pivot-operations.d.ts +0 -160
  585. package/esm/relations/pivot-operations.d.ts.map +0 -1
  586. package/esm/relations/pivot-operations.js +0 -293
  587. package/esm/relations/pivot-operations.js.map +0 -1
  588. package/esm/relations/relation-hydrator.d.ts +0 -68
  589. package/esm/relations/relation-hydrator.d.ts.map +0 -1
  590. package/esm/relations/relation-hydrator.js +0 -81
  591. package/esm/relations/relation-hydrator.js.map +0 -1
  592. package/esm/relations/relation-loader.d.ts +0 -194
  593. package/esm/relations/relation-loader.d.ts.map +0 -1
  594. package/esm/relations/relation-loader.js +0 -466
  595. package/esm/relations/relation-loader.js.map +0 -1
  596. package/esm/relations/types.d.ts +0 -306
  597. package/esm/relations/types.d.ts.map +0 -1
  598. package/esm/remover/database-remover.d.ts +0 -100
  599. package/esm/remover/database-remover.d.ts.map +0 -1
  600. package/esm/remover/database-remover.js +0 -214
  601. package/esm/remover/database-remover.js.map +0 -1
  602. package/esm/restorer/database-restorer.d.ts +0 -131
  603. package/esm/restorer/database-restorer.d.ts.map +0 -1
  604. package/esm/restorer/database-restorer.js +0 -434
  605. package/esm/restorer/database-restorer.js.map +0 -1
  606. package/esm/sql-database-dirty-tracker.d.ts +0 -13
  607. package/esm/sql-database-dirty-tracker.d.ts.map +0 -1
  608. package/esm/sql-database-dirty-tracker.js +0 -14
  609. package/esm/sql-database-dirty-tracker.js.map +0 -1
  610. package/esm/sync/index.d.ts +0 -12
  611. package/esm/sync/index.d.ts.map +0 -1
  612. package/esm/sync/model-events.d.ts +0 -62
  613. package/esm/sync/model-events.d.ts.map +0 -1
  614. package/esm/sync/model-events.js +0 -49
  615. package/esm/sync/model-events.js.map +0 -1
  616. package/esm/sync/model-sync-operation.d.ts +0 -163
  617. package/esm/sync/model-sync-operation.d.ts.map +0 -1
  618. package/esm/sync/model-sync-operation.js +0 -292
  619. package/esm/sync/model-sync-operation.js.map +0 -1
  620. package/esm/sync/model-sync.d.ts +0 -130
  621. package/esm/sync/model-sync.d.ts.map +0 -1
  622. package/esm/sync/model-sync.js +0 -178
  623. package/esm/sync/model-sync.js.map +0 -1
  624. package/esm/sync/sync-context.d.ts +0 -70
  625. package/esm/sync/sync-context.d.ts.map +0 -1
  626. package/esm/sync/sync-context.js +0 -101
  627. package/esm/sync/sync-context.js.map +0 -1
  628. package/esm/sync/sync-manager.d.ts +0 -213
  629. package/esm/sync/sync-manager.d.ts.map +0 -1
  630. package/esm/sync/sync-manager.js +0 -689
  631. package/esm/sync/sync-manager.js.map +0 -1
  632. package/esm/sync/types.d.ts +0 -289
  633. package/esm/sync/types.d.ts.map +0 -1
  634. package/esm/test-migrations/test-enhanced-features.migration.d.ts +0 -15
  635. package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
  636. package/esm/types.d.ts +0 -371
  637. package/esm/types.d.ts.map +0 -1
  638. package/esm/utils/connect-to-database.d.ts +0 -300
  639. package/esm/utils/connect-to-database.d.ts.map +0 -1
  640. package/esm/utils/connect-to-database.js +0 -128
  641. package/esm/utils/connect-to-database.js.map +0 -1
  642. package/esm/utils/database-writer.utils.d.ts +0 -15
  643. package/esm/utils/database-writer.utils.d.ts.map +0 -1
  644. package/esm/utils/database-writer.utils.js +0 -14
  645. package/esm/utils/database-writer.utils.js.map +0 -1
  646. package/esm/utils/define-model.js +0 -100
  647. package/esm/utils/define-model.js.map +0 -1
  648. package/esm/utils/is-valid-date-value.d.ts +0 -5
  649. package/esm/utils/is-valid-date-value.d.ts.map +0 -1
  650. package/esm/utils/is-valid-date-value.js +0 -25
  651. package/esm/utils/is-valid-date-value.js.map +0 -1
  652. package/esm/utils/once-connected.d.ts +0 -146
  653. package/esm/utils/once-connected.d.ts.map +0 -1
  654. package/esm/utils/once-connected.js +0 -251
  655. package/esm/utils/once-connected.js.map +0 -1
  656. package/esm/validation/database-seal-plugins.d.ts +0 -12
  657. package/esm/validation/database-seal-plugins.d.ts.map +0 -1
  658. package/esm/validation/database-seal-plugins.js +0 -1
  659. package/esm/validation/database-seal-plugins.js.map +0 -1
  660. package/esm/validation/database-writer-validation-error.d.ts +0 -97
  661. package/esm/validation/database-writer-validation-error.d.ts.map +0 -1
  662. package/esm/validation/database-writer-validation-error.js +0 -160
  663. package/esm/validation/database-writer-validation-error.js.map +0 -1
  664. package/esm/validation/index.d.ts +0 -3
  665. package/esm/validation/index.d.ts.map +0 -1
  666. package/esm/validation/mutators/embed-mutator.d.ts +0 -9
  667. package/esm/validation/mutators/embed-mutator.d.ts.map +0 -1
  668. package/esm/validation/mutators/embed-mutator.js +0 -33
  669. package/esm/validation/mutators/embed-mutator.js.map +0 -1
  670. package/esm/validation/plugins/embed-validator-plugin.d.ts +0 -24
  671. package/esm/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
  672. package/esm/validation/plugins/embed-validator-plugin.js +0 -18
  673. package/esm/validation/plugins/embed-validator-plugin.js.map +0 -1
  674. package/esm/validation/rules/database-model-rule.d.ts +0 -7
  675. package/esm/validation/rules/database-model-rule.d.ts.map +0 -1
  676. package/esm/validation/rules/database-model-rule.js +0 -27
  677. package/esm/validation/rules/database-model-rule.js.map +0 -1
  678. package/esm/validation/transformers/embed-model-transformer.d.ts +0 -3
  679. package/esm/validation/transformers/embed-model-transformer.d.ts.map +0 -1
  680. package/esm/validation/transformers/embed-model-transformer.js +0 -18
  681. package/esm/validation/transformers/embed-model-transformer.js.map +0 -1
  682. package/esm/validation/validators/embed-validator.d.ts +0 -21
  683. package/esm/validation/validators/embed-validator.d.ts.map +0 -1
  684. package/esm/validation/validators/embed-validator.js +0 -43
  685. package/esm/validation/validators/embed-validator.js.map +0 -1
  686. package/esm/writer/database-writer.d.ts +0 -181
  687. package/esm/writer/database-writer.d.ts.map +0 -1
  688. package/esm/writer/database-writer.js +0 -407
  689. package/esm/writer/database-writer.js.map +0 -1
@@ -1,1992 +0,0 @@
1
- import type { ColumnDefinition, ForeignKeyDefinition, FullTextIndexOptions, GeoIndexOptions, IndexDefinition, MigrationDriverContract, TableIndexInformation, VectorIndexOptions } from "../contracts/migration-driver.contract";
2
- import type { DataSource } from "../data-source/data-source";
3
- import type { ChildModel, Model } from "../model/model";
4
- import type { MigrationDefaults } from "../types";
5
- import { DatabaseDriver } from "../utils/connect-to-database";
6
- import { ColumnBuilder } from "./column-builder";
7
- import { ForeignKeyBuilder } from "./foreign-key-builder";
8
- /**
9
- * Pending operation types supported by migrations.
10
- */
11
- export type OperationType = "addColumn" | "dropColumn" | "dropColumns" | "renameColumn" | "modifyColumn" | "createIndex" | "dropIndex" | "createUniqueIndex" | "dropUniqueIndex" | "createFullTextIndex" | "dropFullTextIndex" | "createGeoIndex" | "dropGeoIndex" | "createVectorIndex" | "dropVectorIndex" | "createTTLIndex" | "dropTTLIndex" | "addForeignKey" | "dropForeignKey" | "addPrimaryKey" | "dropPrimaryKey" | "addCheck" | "dropCheck" | "createTable" | "createTableIfNotExists" | "dropTable" | "dropTableIfExists" | "renameTable" | "truncateTable" | "createTimestamps" | "rawStatement" | "setSchemaValidation" | "removeSchemaValidation";
12
- /**
13
- * Pending operation to be executed when migration runs.
14
- */
15
- export type PendingOperation = {
16
- readonly type: OperationType;
17
- readonly payload: unknown;
18
- };
19
- /**
20
- * Contract for a migration class.
21
- */
22
- export interface MigrationContract {
23
- /**
24
- * Table/collection name for this migration.
25
- */
26
- readonly table: string;
27
- /**
28
- * Optional data source override.
29
- */
30
- readonly dataSource?: string | DataSource;
31
- /**
32
- * Whether to wrap migration in a transaction.
33
- */
34
- readonly transactional?: boolean;
35
- /**
36
- * Define schema changes for the up migration.
37
- */
38
- up(): void | Promise<void>;
39
- /**
40
- * Define rollback operations for the down migration.
41
- */
42
- down(): void | Promise<void>;
43
- /**
44
- * Set the migration driver.
45
- *
46
- * @param driver - Migration driver instance
47
- * @internal
48
- */
49
- setDriver(driver: MigrationDriverContract): void;
50
- /**
51
- * Set migration defaults from the resolved DataSource.
52
- *
53
- * @param defaults - Migration defaults (UUID strategy, etc.)
54
- * @internal
55
- */
56
- setMigrationDefaults(defaults?: MigrationDefaults): void;
57
- /**
58
- * Get the migration driver.
59
- *
60
- * @returns The migration driver instance
61
- */
62
- getDriver(): MigrationDriverContract;
63
- /**
64
- * Execute all pending operations.
65
- *
66
- * @internal
67
- */
68
- execute(): Promise<void>;
69
- /**
70
- * Add a pending index definition.
71
- *
72
- * @param index - Index definition
73
- * @internal
74
- */
75
- addPendingIndex(index: IndexDefinition): void;
76
- /**
77
- * Add a foreign key operation.
78
- *
79
- * @param fk - Foreign key definition
80
- * @internal
81
- */
82
- addForeignKeyOperation(fk: ForeignKeyDefinition): void;
83
- /**
84
- * Create the table/collection.
85
- */
86
- createTable(): MigrationContract;
87
- /**
88
- * Create table if not exists
89
- */
90
- createTableIfNotExists(): MigrationContract;
91
- /**
92
- * Drop the table/collection.
93
- */
94
- dropTable(): MigrationContract;
95
- /**
96
- * Drop the table/collection if it exists.
97
- */
98
- dropTableIfExists(): MigrationContract;
99
- /**
100
- * Rename the table/collection.
101
- *
102
- * @param newName - New table name
103
- */
104
- renameTableTo(newName: string): MigrationContract;
105
- /**
106
- * Truncate the table — remove all rows without logging or firing triggers.
107
- */
108
- truncateTable(): MigrationContract;
109
- /**
110
- * Add a string/varchar column.
111
- */
112
- string(column: string, length?: number): ColumnBuilder;
113
- /**
114
- * Add a fixed-length char column.
115
- */
116
- char(column: string, length: number): ColumnBuilder;
117
- /**
118
- * Add a text column (unlimited length).
119
- */
120
- text(column: string): ColumnBuilder;
121
- /**
122
- * Add a medium text column.
123
- */
124
- mediumText(column: string): ColumnBuilder;
125
- /**
126
- * Add a long text column.
127
- */
128
- longText(column: string): ColumnBuilder;
129
- /**
130
- * Add an integer column.
131
- */
132
- integer(column: string): ColumnBuilder;
133
- /**
134
- * Alias for integer().
135
- */
136
- int(column: string): ColumnBuilder;
137
- /**
138
- * Add a small integer column.
139
- */
140
- smallInteger(column: string): ColumnBuilder;
141
- /**
142
- * Alias for smallInteger().
143
- */
144
- smallInt(column: string): ColumnBuilder;
145
- /**
146
- * Add a tiny integer column.
147
- */
148
- tinyInteger(column: string): ColumnBuilder;
149
- /**
150
- * Alias for tinyInteger().
151
- */
152
- tinyInt(column: string): ColumnBuilder;
153
- /**
154
- * Add a big integer column.
155
- */
156
- bigInteger(column: string): ColumnBuilder;
157
- /**
158
- * Alias for bigInteger().
159
- */
160
- bigInt(column: string): ColumnBuilder;
161
- /**
162
- * Add a float column.
163
- */
164
- float(column: string): ColumnBuilder;
165
- /**
166
- * Add a double precision column.
167
- */
168
- double(column: string): ColumnBuilder;
169
- /**
170
- * Add a decimal column with precision and scale.
171
- */
172
- decimal(column: string, precision?: number, scale?: number): ColumnBuilder;
173
- /**
174
- * Add a boolean column.
175
- */
176
- boolean(column: string): ColumnBuilder;
177
- /**
178
- * Alias for boolean().
179
- */
180
- bool(column: string): ColumnBuilder;
181
- /**
182
- * Add a date column (date only, no time).
183
- */
184
- date(column: string): ColumnBuilder;
185
- /**
186
- * Add a datetime column (date and time).
187
- */
188
- dateTime(column: string): ColumnBuilder;
189
- /**
190
- * Add a timestamp column.
191
- */
192
- timestamp(column: string): ColumnBuilder;
193
- /**
194
- * Add a time column (time only, no date).
195
- */
196
- time(column: string): ColumnBuilder;
197
- /**
198
- * Add a year column.
199
- */
200
- year(column: string): ColumnBuilder;
201
- /**
202
- * Add a JSON column.
203
- */
204
- json(column: string): ColumnBuilder;
205
- /**
206
- * Alias for json().
207
- */
208
- object(column: string): ColumnBuilder;
209
- /**
210
- * Add a binary/blob column.
211
- */
212
- binary(column: string): ColumnBuilder;
213
- /**
214
- * Alias for binary().
215
- */
216
- blob(column: string): ColumnBuilder;
217
- /**
218
- * Add a UUID column.
219
- */
220
- uuid(column: string): ColumnBuilder;
221
- /**
222
- * Add a ULID column.
223
- */
224
- ulid(column: string): ColumnBuilder;
225
- /**
226
- * Add an IP address column.
227
- */
228
- ipAddress(column: string): ColumnBuilder;
229
- /**
230
- * Add a MAC address column.
231
- */
232
- macAddress(column: string): ColumnBuilder;
233
- /**
234
- * Add a geo point column.
235
- */
236
- point(column: string): ColumnBuilder;
237
- /**
238
- * Add a polygon column.
239
- */
240
- polygon(column: string): ColumnBuilder;
241
- /**
242
- * Add a line string column.
243
- */
244
- lineString(column: string): ColumnBuilder;
245
- /**
246
- * Add a generic geometry column.
247
- */
248
- geometry(column: string): ColumnBuilder;
249
- /**
250
- * Add a vector column for AI embeddings.
251
- */
252
- vector(column: string, dimensions: number): ColumnBuilder;
253
- /**
254
- * Add an enum column with allowed values.
255
- */
256
- enum(column: string, values: string[]): ColumnBuilder;
257
- /**
258
- * Add a set column (multiple values from a set).
259
- */
260
- set(column: string, values: string[]): ColumnBuilder;
261
- /** INTEGER[] — array of integers. */
262
- arrayInt(column: string): ColumnBuilder;
263
- /** BIGINT[] — array of big integers. */
264
- arrayBigInt(column: string): ColumnBuilder;
265
- /** REAL[] — array of floats. */
266
- arrayFloat(column: string): ColumnBuilder;
267
- /** DECIMAL[] — array of decimals (optional precision/scale). */
268
- arrayDecimal(column: string, precision?: number, scale?: number): ColumnBuilder;
269
- /** BOOLEAN[] — array of booleans. */
270
- arrayBoolean(column: string): ColumnBuilder;
271
- /** TEXT[] — array of text values. */
272
- arrayText(column: string): ColumnBuilder;
273
- /** DATE[] — array of dates. */
274
- arrayDate(column: string): ColumnBuilder;
275
- /** TIMESTAMPTZ[] — array of timestamps with time zone. */
276
- arrayTimestamp(column: string): ColumnBuilder;
277
- /** UUID[] — array of UUIDs. */
278
- arrayUuid(column: string): ColumnBuilder;
279
- /**
280
- * Add an auto-increment primary key column.
281
- */
282
- id(name?: string): ColumnBuilder;
283
- /**
284
- * Add a big integer auto-increment primary key column.
285
- */
286
- bigId(name?: string): ColumnBuilder;
287
- /**
288
- * Add a UUID primary key column.
289
- */
290
- uuidId(name?: string): ColumnBuilder;
291
- /**
292
- * Add a UUID primary key column with automatic generation.
293
- *
294
- * PostgreSQL: Uses gen_random_uuid() (built-in since PG 13)
295
- * MongoDB: Application-level UUID generation
296
- *
297
- * @param name - Column name (default: "id")
298
- * @returns Column builder for chaining modifiers
299
- *
300
- * @example
301
- * ```typescript
302
- * this.primaryUuid(); // id UUID PRIMARY KEY DEFAULT gen_random_uuid()
303
- * this.primaryUuid("organization_id"); // Custom column name
304
- * ```
305
- */
306
- primaryUuid(name?: string): ColumnBuilder;
307
- /**
308
- * Add createdAt and updatedAt timestamp columns.
309
- */
310
- timestamps(): MigrationContract;
311
- /**
312
- * Add a deletedAt column for soft deletes.
313
- */
314
- softDeletes(column?: string): ColumnBuilder;
315
- /**
316
- * Drop a column.
317
- */
318
- dropColumn(column: string): MigrationContract;
319
- /**
320
- * Drop multiple columns.
321
- */
322
- dropColumns(...columns: string[]): MigrationContract;
323
- /**
324
- * Rename a column.
325
- */
326
- renameColumn(from: string, to: string): MigrationContract;
327
- /**
328
- * Create an index on one or more columns.
329
- *
330
- * @param columns - Column(s) to index
331
- * @param name - Optional index name
332
- * @param options - Optional index options (include, concurrently)
333
- */
334
- index(columns: string | string[], name?: string, options?: {
335
- include?: string[];
336
- concurrently?: boolean;
337
- }): MigrationContract;
338
- /**
339
- * Drop an index by name or columns.
340
- */
341
- dropIndex(nameOrColumns: string | string[]): MigrationContract;
342
- /**
343
- * Create a unique constraint/index.
344
- *
345
- * @param columns - Column(s) to make unique
346
- * @param name - Optional constraint name
347
- * @param options - Optional index options (include, concurrently)
348
- */
349
- unique(columns: string | string[], name?: string, options?: {
350
- include?: string[];
351
- concurrently?: boolean;
352
- }): MigrationContract;
353
- /**
354
- * Drop a unique constraint/index.
355
- */
356
- dropUnique(columns: string | string[]): MigrationContract;
357
- /**
358
- * Create an expression-based index.
359
- *
360
- * @param expressions - SQL expression(s) to index, e.g., ['lower(email)', 'upper(name)']
361
- * @param name - Optional index name
362
- * @param options - Optional index options (concurrently)
363
- */
364
- expressionIndex(expressions: string | string[], name?: string, options?: {
365
- concurrently?: boolean;
366
- }): MigrationContract;
367
- /**
368
- * Create a full-text search index.
369
- */
370
- fullText(columns: string | string[], options?: FullTextIndexOptions): MigrationContract;
371
- /**
372
- * Drop a full-text search index.
373
- */
374
- dropFullText(name: string): MigrationContract;
375
- /**
376
- * Create a geo-spatial index.
377
- */
378
- geoIndex(column: string, options?: GeoIndexOptions): MigrationContract;
379
- /**
380
- * Drop a geo-spatial index.
381
- */
382
- dropGeoIndex(column: string): MigrationContract;
383
- /**
384
- * Create a vector search index for AI embeddings.
385
- */
386
- vectorIndex(column: string, options: VectorIndexOptions): MigrationContract;
387
- /**
388
- * Drop a vector search index.
389
- */
390
- dropVectorIndex(column: string): MigrationContract;
391
- /**
392
- * Create a TTL (time-to-live) index for automatic document expiration.
393
- */
394
- ttlIndex(column: string, expireAfterSeconds: number): MigrationContract;
395
- /**
396
- * Drop a TTL index.
397
- */
398
- dropTTLIndex(column: string): MigrationContract;
399
- /**
400
- * Add a composite primary key.
401
- */
402
- primaryKey(columns: string[]): MigrationContract;
403
- /**
404
- * Drop the primary key constraint.
405
- */
406
- dropPrimaryKey(): MigrationContract;
407
- /**
408
- * Start building a foreign key constraint.
409
- */
410
- foreign(column: string): ForeignKeyBuilder;
411
- /**
412
- * Drop a foreign key constraint.
413
- *
414
- * When `referencesTable` is provided, the constraint name is auto-computed
415
- * using the same convention as `addForeignKey`:
416
- * `fk_{table}_{column}_{referencesTable}`
417
- *
418
- * When omitted, `columnOrConstraint` is used as the raw constraint name.
419
- */
420
- dropForeign(columnOrConstraint: string, referencesTable?: string): MigrationContract;
421
- /**
422
- * Set JSON schema validation rules on the collection.
423
- */
424
- schemaValidation(schema: object): MigrationContract;
425
- /**
426
- * Remove schema validation rules from the collection.
427
- */
428
- dropSchemaValidation(): MigrationContract;
429
- /**
430
- * Check if a table exists.
431
- */
432
- hasTable(tableName: string): Promise<boolean>;
433
- /**
434
- * Check if a column exists in the current table.
435
- */
436
- hasColumn(columnName: string): Promise<boolean>;
437
- /**
438
- * Get all columns in the current table.
439
- */
440
- getColumns(): Promise<ColumnDefinition[]>;
441
- /**
442
- * List all tables in the current database/connection.
443
- */
444
- listTables(): Promise<string[]>;
445
- /**
446
- * Get all indexes on the current table.
447
- */
448
- getIndexes(): Promise<TableIndexInformation[]>;
449
- /**
450
- * Check if a named index exists on the current table.
451
- */
452
- hasIndex(indexName: string): Promise<boolean>;
453
- /**
454
- * Queue a raw SQL string for execution within the migration.
455
- *
456
- * @param sql - SQL statement to execute
457
- */
458
- raw(sql: string): this;
459
- /**
460
- * Execute raw operations with direct driver/connection access.
461
- *
462
- * @param callback - Callback receiving the native connection
463
- */
464
- withConnection<T>(callback: (connection: unknown) => Promise<T>): Promise<T>;
465
- /**
466
- * Add a vector column for storing AI embeddings.
467
- *
468
- * @param column - Column name
469
- * @param dimensions - Embedding size (e.g. 1536 for text-embedding-3-small)
470
- */
471
- vector(column: string, dimensions: number): ColumnBuilder;
472
- }
473
- /**
474
- * Constructor for the migration class.
475
- */
476
- export interface MigrationConstructor {
477
- new (): MigrationContract;
478
- migrationName?: string;
479
- createdAt?: string;
480
- transactional?: boolean;
481
- order?: number;
482
- }
483
- /**
484
- * Base class for all database migrations.
485
- *
486
- * Provides a fluent API for defining schema changes that work across
487
- * both SQL and NoSQL databases. The migration driver handles translating
488
- * operations to native database commands.
489
- *
490
- * Migrations are executed in order based on their `createdAt` timestamp,
491
- * which is typically extracted from the filename (e.g., `2024-01-15_create-users`).
492
- *
493
- * @example
494
- * ```typescript
495
- * // Using Migration.for() to bind to a model
496
- * export default class extends Migration.for(User) {
497
- * public up(): void {
498
- * this.string("email").unique();
499
- * this.integer("age").nullable();
500
- * this.geoIndex("location");
501
- * }
502
- *
503
- * public down(): void {
504
- * this.dropColumn("email");
505
- * this.dropColumn("age");
506
- * this.dropGeoIndex("location");
507
- * }
508
- * }
509
- * ```
510
- *
511
- * @example
512
- * ```typescript
513
- * // Manual table migration (without model binding)
514
- * export default class CreateUsersTable extends Migration {
515
- * public readonly table = "users";
516
- *
517
- * public up(): void {
518
- * this.createTable();
519
- * this.id();
520
- * this.string("name");
521
- * this.string("email").unique();
522
- * this.timestamps();
523
- * }
524
- *
525
- * public down(): void {
526
- * this.dropTable();
527
- * }
528
- * }
529
- * ```
530
- */
531
- export declare abstract class Migration implements MigrationContract {
532
- /**
533
- * Migration name that will be labeled with
534
- * If record is enabled in migration, it will be stored as migration name
535
- * in database
536
- *
537
- * @example
538
- * ```typescript
539
- * "2024-01-15_create-users";
540
- * ```
541
- */
542
- static migrationName?: string;
543
- /**
544
- * Table/collection name for this migration.
545
- *
546
- * Must be defined by each migration class (either directly or via `Migration.for()`).
547
- */
548
- readonly table: string;
549
- /**
550
- * Sort order
551
- * If not provided, it will be ordered alphabetically
552
- */
553
- static readonly order?: number;
554
- /**
555
- * Optional data source override.
556
- *
557
- * If specified, this migration will use a specific data source
558
- * instead of the default one. Can be a string name or DataSource instance.
559
- */
560
- readonly dataSource?: string | DataSource;
561
- /**
562
- * Optional timestamp override.
563
- *
564
- * By default, the migration runner extracts this from the filename.
565
- * Set explicitly to override the execution order.
566
- *
567
- * Format: ISO 8601 or any parseable date string.
568
- */
569
- static readonly createdAt?: string;
570
- /**
571
- * Whether to wrap migration in a transaction.
572
- *
573
- * Defaults to `true` for SQL databases that support DDL transactions.
574
- * Set to `false` for operations that cannot be transactional.
575
- *
576
- * Note: MongoDB does not support transactions for most DDL operations.
577
- */
578
- readonly transactional?: boolean;
579
- /**
580
- * Migration driver instance (injected by the runner).
581
- */
582
- protected driver: MigrationDriverContract;
583
- /**
584
- * Migration defaults from the resolved DataSource.
585
- * @internal
586
- */
587
- /** @internal — readable by factory-generated subclasses */
588
- protected _migrationDefaults?: MigrationDefaults;
589
- /**
590
- * Queued operations to execute.
591
- */
592
- private readonly pendingOperations;
593
- /**
594
- * Define schema changes for the up migration.
595
- *
596
- * Called when running migrations forward. Add columns, indexes,
597
- * constraints, etc. in this method.
598
- */
599
- abstract up(): void | Promise<void>;
600
- /**
601
- * Define rollback operations for the down migration.
602
- *
603
- * Called when rolling back migrations. Drop columns, indexes,
604
- * and undo any changes made in `up()`.
605
- */
606
- abstract down(): void | Promise<void>;
607
- /**
608
- * Create a migration class bound to a specific model.
609
- *
610
- * Automatically inherits the model's table name and data source,
611
- * reducing boilerplate and ensuring consistency.
612
- *
613
- * @param model - Model class to bind
614
- * @returns Abstract migration class bound to the model
615
- *
616
- * @example
617
- * ```typescript
618
- * export default class extends Migration.for(User) {
619
- * public up(): void {
620
- * this.string("avatar").nullable();
621
- * }
622
- *
623
- * public down(): void {
624
- * this.dropColumn("avatar");
625
- * }
626
- * }
627
- * ```
628
- */
629
- static for<T extends ChildModel<Model>>(model: T): MigrationConstructor;
630
- /**
631
- * Set the migration driver.
632
- *
633
- * Called by the migration runner before executing up/down.
634
- *
635
- * @param driver - Migration driver instance
636
- * @internal
637
- */
638
- setDriver(driver: MigrationDriverContract): void;
639
- /**
640
- * Set migration defaults from the resolved DataSource.
641
- *
642
- * @param defaults - Migration defaults (UUID strategy, etc.)
643
- * @internal
644
- */
645
- setMigrationDefaults(defaults?: MigrationDefaults): void;
646
- /**
647
- * Get the migration driver.
648
- *
649
- * @returns The migration driver instance
650
- */
651
- getDriver(): MigrationDriverContract;
652
- /**
653
- * Get database engine (MongoDB, Postgress...etc)
654
- */
655
- get databaseEngine(): DatabaseDriver;
656
- /**
657
- * Execute all pending operations.
658
- *
659
- * @deprecated Use toSQL() instead — migrations now generate SQL rather than
660
- * executing DDL directly through the driver.
661
- * @internal
662
- */
663
- execute(): Promise<void>;
664
- /**
665
- * Serialize all queued pending operations into a flat list of SQL strings.
666
- *
667
- * Call this AFTER invoking `up()` or `down()` to extract the SQL for the
668
- * operations that were queued during that call. The pending queue is cleared
669
- * after serializing so the instance is safe to reuse.
670
- *
671
- * @example
672
- * ```typescript
673
- * const migration = new CreateUsersTable();
674
- * migration.setDriver(driver);
675
- *
676
- * // Up SQL
677
- * await migration.up();
678
- * const upSQL = migration.toSQL();
679
- *
680
- * // Down SQL — reuse the same instance
681
- * await migration.down();
682
- * const downSQL = migration.toSQL();
683
- * ```
684
- */
685
- toSQL(): string[];
686
- /**
687
- * Execute a single pending operation.
688
- */
689
- private executeOperation;
690
- /**
691
- * Check if a table exists.
692
- *
693
- * Useful for conditional migrations and idempotent operations.
694
- *
695
- * @param tableName - Table name to check
696
- * @returns Promise resolving to true if table exists
697
- *
698
- * @example
699
- * ```typescript
700
- * public async up() {
701
- * if (await this.hasTable("users_backup")) {
702
- * this.dropTable("users_backup");
703
- * }
704
- * // ... rest of migration
705
- * }
706
- * ```
707
- */
708
- hasTable(tableName: string): Promise<boolean>;
709
- /**
710
- * Check if a column exists in the current table.
711
- *
712
- * @param columnName - Column name to check
713
- * @returns Promise resolving to true if column exists
714
- *
715
- * @example
716
- * ```typescript
717
- * public async up() {
718
- * if (!(await this.hasColumn("email"))) {
719
- * this.string("email").unique();
720
- * }
721
- * }
722
- * ```
723
- */
724
- hasColumn(columnName: string): Promise<boolean>;
725
- /**
726
- * Get all columns in the current table.
727
- *
728
- * @returns Promise resolving to array of column definitions
729
- *
730
- * @example
731
- * ```typescript
732
- * const columns = await this.getColumns();
733
- * if (columns.find(col => col.type === "string" && !col.length)) {
734
- * // migrate all unbounded strings
735
- * }
736
- * ```
737
- */
738
- getColumns(): Promise<ColumnDefinition[]>;
739
- /**
740
- * List all tables in the current database/connection.
741
- *
742
- * @returns Promise resolving to array of table names
743
- *
744
- * @example
745
- * ```typescript
746
- * const tables = await this.listTables();
747
- * for (const table of tables) {
748
- * // process each table
749
- * }
750
- * ```
751
- */
752
- listTables(): Promise<string[]>;
753
- /**
754
- * Get all indexes on the current table.
755
- */
756
- getIndexes(): Promise<TableIndexInformation[]>;
757
- /**
758
- * Check if a named index exists on the current table.
759
- */
760
- hasIndex(indexName: string): Promise<boolean>;
761
- /**
762
- * Add a pending index definition.
763
- *
764
- * Called by ColumnBuilder when .unique() or .index() is chained.
765
- * Routes into pendingOperations so indexes execute in definition order
766
- * alongside columns and constraints.
767
- *
768
- * @param index - Index definition
769
- * @internal
770
- */
771
- addPendingIndex(index: IndexDefinition): void;
772
- /**
773
- * Add a foreign key operation.
774
- *
775
- * Called by ForeignKeyBuilder or ColumnBuilder when .references() is called.
776
- *
777
- * @param fk - Foreign key definition
778
- * @internal
779
- */
780
- addForeignKeyOperation(fk: ForeignKeyDefinition): void;
781
- /**
782
- * Create the table/collection.
783
- *
784
- * For SQL, this creates an empty table.
785
- * For MongoDB, this creates the collection.
786
- *
787
- * @returns This migration for chaining
788
- */
789
- createTable(): this;
790
- /**
791
- * Create table if not exists
792
- */
793
- createTableIfNotExists(): this;
794
- /**
795
- * Drop the table/collection.
796
- *
797
- * @returns This migration for chaining
798
- */
799
- dropTable(): this;
800
- /**
801
- * Drop the table/collection if it exists.
802
- *
803
- * No error is thrown if the table doesn't exist.
804
- *
805
- * @returns This migration for chaining
806
- */
807
- dropTableIfExists(): this;
808
- /**
809
- * Rename the table/collection.
810
- *
811
- * @param newName - New table name
812
- * @returns This migration for chaining
813
- */
814
- renameTableTo(newName: string): this;
815
- /**
816
- * Truncate the table — remove all rows without logging or firing triggers.
817
- *
818
- * Faster than DELETE with no WHERE clause. Resets auto-increment counters
819
- * on most databases.
820
- *
821
- * @returns This migration for chaining
822
- */
823
- truncateTable(): this;
824
- /**
825
- * Add a string/varchar column.
826
- *
827
- * @param column - Column name
828
- * @param length - Max length (default: 255)
829
- * @returns Column builder for chaining modifiers
830
- *
831
- * @example
832
- * ```typescript
833
- * this.string("name"); // VARCHAR(255)
834
- * this.string("code", 10); // VARCHAR(10)
835
- * ```
836
- */
837
- string(column: string, length?: number): ColumnBuilder;
838
- /**
839
- * Add a fixed-length char column.
840
- *
841
- * @param column - Column name
842
- * @param length - Exact length
843
- * @returns Column builder for chaining modifiers
844
- */
845
- char(column: string, length: number): ColumnBuilder;
846
- /**
847
- * Add a text column (unlimited length).
848
- *
849
- * @param column - Column name
850
- * @returns Column builder for chaining modifiers
851
- */
852
- text(column: string): ColumnBuilder;
853
- /**
854
- * Add a medium text column.
855
- *
856
- * @param column - Column name
857
- * @returns Column builder for chaining modifiers
858
- */
859
- mediumText(column: string): ColumnBuilder;
860
- /**
861
- * Add a long text column.
862
- *
863
- * @param column - Column name
864
- * @returns Column builder for chaining modifiers
865
- */
866
- longText(column: string): ColumnBuilder;
867
- /**
868
- * Add an integer column.
869
- *
870
- * @param column - Column name
871
- * @returns Column builder for chaining modifiers
872
- */
873
- integer(column: string): ColumnBuilder;
874
- /**
875
- * Alias for integer().
876
- */
877
- int(column: string): ColumnBuilder;
878
- /**
879
- * Add a small integer column.
880
- *
881
- * @param column - Column name
882
- * @returns Column builder for chaining modifiers
883
- */
884
- smallInteger(column: string): ColumnBuilder;
885
- /**
886
- * Alias for smallInteger().
887
- */
888
- smallInt(column: string): ColumnBuilder;
889
- /**
890
- * Add a tiny integer column.
891
- *
892
- * @param column - Column name
893
- * @returns Column builder for chaining modifiers
894
- */
895
- tinyInteger(column: string): ColumnBuilder;
896
- /**
897
- * Alias for tinyInteger().
898
- */
899
- tinyInt(column: string): ColumnBuilder;
900
- /**
901
- * Add a big integer column.
902
- *
903
- * @param column - Column name
904
- * @returns Column builder for chaining modifiers
905
- */
906
- bigInteger(column: string): ColumnBuilder;
907
- /**
908
- * Alias for bigInteger().
909
- */
910
- bigInt(column: string): ColumnBuilder;
911
- /**
912
- * Add a float column.
913
- *
914
- * @param column - Column name
915
- * @returns Column builder for chaining modifiers
916
- */
917
- float(column: string): ColumnBuilder;
918
- /**
919
- * Add a double precision column.
920
- *
921
- * @param column - Column name
922
- * @returns Column builder for chaining modifiers
923
- */
924
- double(column: string): ColumnBuilder;
925
- /**
926
- * Add a decimal column with precision and scale.
927
- *
928
- * @param column - Column name
929
- * @param precision - Total digits (default: 8)
930
- * @param scale - Decimal places (default: 2)
931
- * @returns Column builder for chaining modifiers
932
- *
933
- * @example
934
- * ```typescript
935
- * this.decimal("price", 10, 2); // DECIMAL(10,2) - up to 99999999.99
936
- * ```
937
- */
938
- decimal(column: string, precision?: number, scale?: number): ColumnBuilder;
939
- /**
940
- * Add a boolean column.
941
- *
942
- * @param column - Column name
943
- * @returns Column builder for chaining modifiers
944
- */
945
- boolean(column: string): ColumnBuilder;
946
- /**
947
- * Alias for boolean().
948
- */
949
- bool(column: string): ColumnBuilder;
950
- /**
951
- * Add a date column (date only, no time).
952
- *
953
- * @param column - Column name
954
- * @returns Column builder for chaining modifiers
955
- */
956
- date(column: string): ColumnBuilder;
957
- /**
958
- * Add a datetime column (date and time).
959
- *
960
- * @param column - Column name
961
- * @returns Column builder for chaining modifiers
962
- */
963
- dateTime(column: string): ColumnBuilder;
964
- /**
965
- * Add a timestamp column.
966
- *
967
- * @param column - Column name
968
- * @returns Column builder for chaining modifiers
969
- */
970
- timestamp(column: string): ColumnBuilder;
971
- /**
972
- * Add a time column (time only, no date).
973
- *
974
- * @param column - Column name
975
- * @returns Column builder for chaining modifiers
976
- */
977
- time(column: string): ColumnBuilder;
978
- /**
979
- * Add a year column.
980
- *
981
- * @param column - Column name
982
- * @returns Column builder for chaining modifiers
983
- */
984
- year(column: string): ColumnBuilder;
985
- /**
986
- * Add a JSON column.
987
- *
988
- * @param column - Column name
989
- * @returns Column builder for chaining modifiers
990
- */
991
- json(column: string): ColumnBuilder;
992
- /**
993
- * Alias for json().
994
- */
995
- object(column: string): ColumnBuilder;
996
- /**
997
- * Add a binary/blob column.
998
- *
999
- * @param column - Column name
1000
- * @returns Column builder for chaining modifiers
1001
- */
1002
- binary(column: string): ColumnBuilder;
1003
- /**
1004
- * Alias for binary().
1005
- */
1006
- blob(column: string): ColumnBuilder;
1007
- /**
1008
- * Add a UUID column.
1009
- *
1010
- * @param column - Column name
1011
- * @returns Column builder for chaining modifiers
1012
- */
1013
- uuid(column: string): ColumnBuilder;
1014
- /**
1015
- * Add a ULID column.
1016
- *
1017
- * @param column - Column name
1018
- * @returns Column builder for chaining modifiers
1019
- */
1020
- ulid(column: string): ColumnBuilder;
1021
- /**
1022
- * Add an IP address column.
1023
- *
1024
- * @param column - Column name
1025
- * @returns Column builder for chaining modifiers
1026
- */
1027
- ipAddress(column: string): ColumnBuilder;
1028
- /**
1029
- * Add a MAC address column.
1030
- *
1031
- * @param column - Column name
1032
- * @returns Column builder for chaining modifiers
1033
- */
1034
- macAddress(column: string): ColumnBuilder;
1035
- /**
1036
- * Add a geo point column.
1037
- *
1038
- * @param column - Column name
1039
- * @returns Column builder for chaining modifiers
1040
- */
1041
- point(column: string): ColumnBuilder;
1042
- /**
1043
- * Add a polygon column.
1044
- *
1045
- * @param column - Column name
1046
- * @returns Column builder for chaining modifiers
1047
- */
1048
- polygon(column: string): ColumnBuilder;
1049
- /**
1050
- * Add a line string column.
1051
- *
1052
- * @param column - Column name
1053
- * @returns Column builder for chaining modifiers
1054
- */
1055
- lineString(column: string): ColumnBuilder;
1056
- /**
1057
- * Add a generic geometry column.
1058
- *
1059
- * @param column - Column name
1060
- * @returns Column builder for chaining modifiers
1061
- */
1062
- geometry(column: string): ColumnBuilder;
1063
- /**
1064
- * Add a vector column for AI embeddings.
1065
- *
1066
- * Used for storing and searching ML embeddings (e.g., OpenAI, Cohere).
1067
- *
1068
- * @param column - Column name
1069
- * @param dimensions - Vector dimensions (e.g., 1536 for OpenAI ada-002)
1070
- * @returns Column builder for chaining modifiers
1071
- *
1072
- * @example
1073
- * ```typescript
1074
- * this.vector("embedding", 1536); // OpenAI ada-002
1075
- * this.vector("embedding", 384); // Sentence Transformers
1076
- * ```
1077
- */
1078
- vector(column: string, dimensions: number): ColumnBuilder;
1079
- /**
1080
- * Add an enum column with allowed values.
1081
- *
1082
- * @param column - Column name
1083
- * @param values - Allowed enum values
1084
- * @returns Column builder for chaining modifiers
1085
- *
1086
- * @example
1087
- * ```typescript
1088
- * this.enum("status", ["pending", "active", "archived"]);
1089
- * ```
1090
- */
1091
- enum(column: string, values: string[]): ColumnBuilder;
1092
- /**
1093
- * Add a set column (multiple values from a set).
1094
- *
1095
- * @param column - Column name
1096
- * @param values - Allowed set values
1097
- * @returns Column builder for chaining modifiers
1098
- */
1099
- set(column: string, values: string[]): ColumnBuilder;
1100
- /**
1101
- * Add an INTEGER[] column (array of integers).
1102
- *
1103
- * @example
1104
- * ```typescript
1105
- * this.arrayInt("scores"); // INTEGER[]
1106
- * ```
1107
- */
1108
- arrayInt(column: string): ColumnBuilder;
1109
- /**
1110
- * Add a BIGINT[] column (array of big integers).
1111
- *
1112
- * @example
1113
- * ```typescript
1114
- * this.arrayBigInt("ids"); // BIGINT[]
1115
- * ```
1116
- */
1117
- arrayBigInt(column: string): ColumnBuilder;
1118
- /**
1119
- * Add a REAL[] column (array of floats).
1120
- *
1121
- * @example
1122
- * ```typescript
1123
- * this.arrayFloat("weights"); // REAL[]
1124
- * ```
1125
- */
1126
- arrayFloat(column: string): ColumnBuilder;
1127
- /**
1128
- * Add a DECIMAL[] column (array of decimals).
1129
- *
1130
- * @param precision - Total digits
1131
- * @param scale - Digits after decimal point
1132
- *
1133
- * @example
1134
- * ```typescript
1135
- * this.arrayDecimal("prices", 10, 2); // DECIMAL(10,2)[]
1136
- * this.arrayDecimal("amounts"); // DECIMAL[]
1137
- * ```
1138
- */
1139
- arrayDecimal(column: string, precision?: number, scale?: number): ColumnBuilder;
1140
- /**
1141
- * Add a BOOLEAN[] column (array of booleans).
1142
- *
1143
- * @example
1144
- * ```typescript
1145
- * this.arrayBoolean("flags"); // BOOLEAN[]
1146
- * ```
1147
- */
1148
- arrayBoolean(column: string): ColumnBuilder;
1149
- /**
1150
- * Add a TEXT[] column (array of text values).
1151
- *
1152
- * @example
1153
- * ```typescript
1154
- * this.arrayText("tags"); // TEXT[]
1155
- * ```
1156
- */
1157
- arrayText(column: string): ColumnBuilder;
1158
- /**
1159
- * Add a DATE[] column (array of dates).
1160
- *
1161
- * @example
1162
- * ```typescript
1163
- * this.arrayDate("holidays"); // DATE[]
1164
- * ```
1165
- */
1166
- arrayDate(column: string): ColumnBuilder;
1167
- /**
1168
- * Add a TIMESTAMPTZ[] column (array of timestamps with time zone).
1169
- *
1170
- * @example
1171
- * ```typescript
1172
- * this.arrayTimestamp("events"); // TIMESTAMPTZ[]
1173
- * ```
1174
- */
1175
- arrayTimestamp(column: string): ColumnBuilder;
1176
- /**
1177
- * Add a UUID[] column (array of UUIDs).
1178
- *
1179
- * @example
1180
- * ```typescript
1181
- * this.arrayUuid("relatedIds"); // UUID[]
1182
- * ```
1183
- */
1184
- arrayUuid(column: string): ColumnBuilder;
1185
- /**
1186
- * Add an auto-increment primary key column.
1187
- *
1188
- * Creates an unsigned integer with primary key and auto-increment.
1189
- *
1190
- * @param name - Column name (default: "id")
1191
- * @returns Column builder for chaining modifiers
1192
- *
1193
- * @example
1194
- * ```typescript
1195
- * this.id(); // Creates "id" column
1196
- * this.id("userId"); // Creates "userId" column
1197
- * ```
1198
- */
1199
- id(name?: string): ColumnBuilder;
1200
- /**
1201
- * Add a big integer auto-increment primary key column.
1202
- *
1203
- * @param name - Column name (default: "id")
1204
- * @returns Column builder for chaining modifiers
1205
- */
1206
- bigId(name?: string): ColumnBuilder;
1207
- /**
1208
- * Add a UUID primary key column.
1209
- *
1210
- * @param name - Column name (default: "id")
1211
- * @returns Column builder for chaining modifiers
1212
- */
1213
- uuidId(name?: string): ColumnBuilder;
1214
- /**
1215
- * Add a UUID primary key column with automatic generation.
1216
- *
1217
- * Delegates UUID expression to the migration driver, which resolves
1218
- * the default based on `migrationDefaults` from the DataSource config.
1219
- *
1220
- * Resolution order:
1221
- * 1. `migrationDefaults.uuidExpression` (raw escape hatch)
1222
- * 2. `migrationDefaults.uuidStrategy` (mapped per driver)
1223
- * 3. Driver default (PostgreSQL: `gen_random_uuid()`, MongoDB: undefined)
1224
- *
1225
- * @param name - Column name (default: "id")
1226
- * @returns Column builder for chaining modifiers
1227
- *
1228
- * @example
1229
- * ```typescript
1230
- * this.primaryUuid(); // id UUID PRIMARY KEY DEFAULT gen_random_uuid()
1231
- * this.primaryUuid("organization_id"); // Custom column name
1232
- * ```
1233
- */
1234
- primaryUuid(name?: string): ColumnBuilder;
1235
- /**
1236
- * Add createdAt and updatedAt timestamp columns.
1237
- *
1238
- * Behavior varies by database driver:
1239
- * - PostgreSQL: Creates TIMESTAMPTZ columns with NOW() defaults
1240
- * - MongoDB: No-op (timestamps handled at application level)
1241
- *
1242
- * @returns This migration for chaining
1243
- *
1244
- * @example
1245
- * ```typescript
1246
- * this.timestamps(); // Driver-specific implementation
1247
- * ```
1248
- */
1249
- timestamps(): this;
1250
- /**
1251
- * Add a deletedAt column for soft deletes.
1252
- *
1253
- * @param column - Column name (default: "deletedAt")
1254
- * @returns Column builder for chaining modifiers
1255
- */
1256
- softDeletes(column?: string): ColumnBuilder;
1257
- /**
1258
- * Drop a column.
1259
- *
1260
- * @param column - Column name to drop
1261
- * @returns This migration for chaining
1262
- */
1263
- dropColumn(column: string): this;
1264
- /**
1265
- * Drop multiple columns.
1266
- *
1267
- * @param columns - Column names to drop
1268
- * @returns This migration for chaining
1269
- */
1270
- dropColumns(...columns: string[]): this;
1271
- /**
1272
- * Rename a column.
1273
- *
1274
- * @param from - Current column name
1275
- * @param to - New column name
1276
- * @returns This migration for chaining
1277
- */
1278
- renameColumn(from: string, to: string): this;
1279
- /**
1280
- * Create an index on one or more columns.
1281
- *
1282
- * @param columns - Column(s) to index
1283
- * @param name - Optional index name
1284
- * @param options - Optional index options (include, concurrently)
1285
- * @returns This migration for chaining
1286
- *
1287
- * @example
1288
- * ```typescript
1289
- * this.index("email");
1290
- * this.index(["firstName", "lastName"], "name_idx");
1291
- * this.index("userId", "idx_user", { include: ["name", "email"] });
1292
- * this.index("email", "idx_email", { concurrently: true });
1293
- * ```
1294
- */
1295
- index(columns: string | string[], name?: string, options?: {
1296
- include?: string[];
1297
- concurrently?: boolean;
1298
- }): this;
1299
- /**
1300
- * Drop an index by name or columns.
1301
- *
1302
- * @param nameOrColumns - Index name (string) or columns array
1303
- * @returns This migration for chaining
1304
- *
1305
- * @example
1306
- * ```typescript
1307
- * this.dropIndex("email_idx"); // Drop by name
1308
- * this.dropIndex(["firstName", "lastName"]); // Drop by columns
1309
- * ```
1310
- */
1311
- dropIndex(nameOrColumns: string | string[]): this;
1312
- /**
1313
- * Create a unique constraint/index.
1314
- *
1315
- * @param columns - Column(s) to make unique
1316
- * @param name - Optional constraint name
1317
- * @param options - Optional index options (include, concurrently)
1318
- * @returns This migration for chaining
1319
- *
1320
- * @example
1321
- * ```typescript
1322
- * this.unique("email");
1323
- * this.unique(["userId", "roleId"], "unique_user_role");
1324
- * this.unique("email", "unique_email", { include: ["name"] });
1325
- * ```
1326
- */
1327
- unique(columns: string | string[], name?: string, options?: {
1328
- include?: string[];
1329
- concurrently?: boolean;
1330
- }): this;
1331
- /**
1332
- * Drop a unique constraint/index.
1333
- *
1334
- * @param columns - Columns in the unique constraint
1335
- * @returns This migration for chaining
1336
- */
1337
- dropUnique(columns: string | string[]): this;
1338
- /**
1339
- * Create an expression-based index.
1340
- *
1341
- * Allows indexing on SQL expressions rather than plain columns.
1342
- * Useful for case-insensitive searches, computed values, etc.
1343
- *
1344
- * **Note**: PostgreSQL-specific feature. MongoDB will silently ignore this.
1345
- *
1346
- * @param expressions - SQL expression(s) to index
1347
- * @param name - Optional index name
1348
- * @param options - Optional index options (concurrently)
1349
- * @returns This migration for chaining
1350
- *
1351
- * @example
1352
- * ```typescript
1353
- * // Case-insensitive email index
1354
- * this.expressionIndex(['lower(email)'], 'idx_email_lower');
1355
- *
1356
- * // Multiple expressions
1357
- * this.expressionIndex(['lower(firstName)', 'lower(lastName)'], 'idx_name_lower');
1358
- *
1359
- * // With concurrent creation (requires transactional = false)
1360
- * this.expressionIndex(['lower(email)'], 'idx_email_lower', { concurrently: true });
1361
- * ```
1362
- */
1363
- expressionIndex(expressions: string | string[], name?: string, options?: {
1364
- concurrently?: boolean;
1365
- }): this;
1366
- /**
1367
- * Create a full-text search index.
1368
- *
1369
- * @param columns - Column(s) to index
1370
- * @param options - Full-text options
1371
- * @returns This migration for chaining
1372
- */
1373
- fullText(columns: string | string[], options?: FullTextIndexOptions): this;
1374
- /**
1375
- * Drop a full-text search index.
1376
- *
1377
- * @param name - Index name
1378
- * @returns This migration for chaining
1379
- */
1380
- dropFullText(name: string): this;
1381
- /**
1382
- * Create a geo-spatial index.
1383
- *
1384
- * @param column - Geo column
1385
- * @param options - Geo index options
1386
- * @returns This migration for chaining
1387
- *
1388
- * @example
1389
- * ```typescript
1390
- * this.geoIndex("location"); // 2dsphere index
1391
- * this.geoIndex("coordinates", { type: "2d" }); // 2d index
1392
- * ```
1393
- */
1394
- geoIndex(column: string, options?: GeoIndexOptions): this;
1395
- /**
1396
- * Drop a geo-spatial index.
1397
- *
1398
- * @param column - Geo column
1399
- * @returns This migration for chaining
1400
- */
1401
- dropGeoIndex(column: string): this;
1402
- /**
1403
- * Create a vector search index for AI embeddings.
1404
- *
1405
- * @param column - Vector column
1406
- * @param options - Vector index options
1407
- * @returns This migration for chaining
1408
- *
1409
- * @example
1410
- * ```typescript
1411
- * this.vectorIndex("embedding", {
1412
- * dimensions: 1536,
1413
- * similarity: "cosine",
1414
- * });
1415
- * ```
1416
- */
1417
- vectorIndex(column: string, options: VectorIndexOptions): this;
1418
- /**
1419
- * Drop a vector search index.
1420
- *
1421
- * @param column - Vector column
1422
- * @returns This migration for chaining
1423
- */
1424
- dropVectorIndex(column: string): this;
1425
- /**
1426
- * Create a TTL (time-to-live) index for automatic document expiration.
1427
- *
1428
- * Primarily for MongoDB. Documents are automatically deleted after the
1429
- * specified time has passed since the date in the column.
1430
- *
1431
- * @param column - Date column to check for expiration
1432
- * @param expireAfterSeconds - Seconds after which documents expire
1433
- * @returns This migration for chaining
1434
- *
1435
- * @example
1436
- * ```typescript
1437
- * // Delete sessions 24 hours after createdAt
1438
- * this.ttlIndex("createdAt", 86400);
1439
- * ```
1440
- */
1441
- ttlIndex(column: string, expireAfterSeconds: number): this;
1442
- /**
1443
- * Drop a TTL index.
1444
- *
1445
- * @param column - Column with TTL
1446
- * @returns This migration for chaining
1447
- */
1448
- dropTTLIndex(column: string): this;
1449
- /**
1450
- * Add a composite primary key.
1451
- *
1452
- * @param columns - Columns to include in the primary key
1453
- * @returns This migration for chaining
1454
- */
1455
- primaryKey(columns: string[]): this;
1456
- /**
1457
- * Drop the primary key constraint.
1458
- *
1459
- * @returns This migration for chaining
1460
- */
1461
- dropPrimaryKey(): this;
1462
- /**
1463
- * Add a CHECK constraint to the table.
1464
- *
1465
- * SQL-only feature. PostgreSQL, MySQL 8.0+, SQLite support this.
1466
- * Validates that rows satisfy the given SQL expression.
1467
- *
1468
- * @param name - Constraint name
1469
- * @param expression - SQL CHECK expression
1470
- * @returns This migration for chaining
1471
- *
1472
- * @example
1473
- * ```typescript
1474
- * this.check("age_positive", "age >= 0");
1475
- * this.check("valid_email", "email LIKE '%@%'");
1476
- * this.check("price_range", "price BETWEEN 0 AND 1000000");
1477
- * ```
1478
- */
1479
- check(name: string, expression: string): this;
1480
- /**
1481
- * Drop a CHECK constraint by name.
1482
- *
1483
- * @param name - Constraint name
1484
- * @returns This migration for chaining
1485
- *
1486
- * @example
1487
- * ```typescript
1488
- * this.dropCheck("age_positive");
1489
- * ```
1490
- */
1491
- dropCheck(name: string): this;
1492
- /**
1493
- * Start building a foreign key constraint on an existing column.
1494
- *
1495
- * Use this when adding a foreign key to a column that was defined in a
1496
- * previous migration. For new columns, prefer the inline form:
1497
- * `this.integer("user_id").references("users").onDelete("cascade")`
1498
- *
1499
- * SQL-only feature; NoSQL drivers ignore foreign keys.
1500
- *
1501
- * @param column - Local column that references another table
1502
- * @returns Foreign key builder for chaining
1503
- *
1504
- * @example
1505
- * ```typescript
1506
- * this.foreign("user_id")
1507
- * .references("users", "id")
1508
- * .onDelete("cascade");
1509
- * ```
1510
- */
1511
- foreign(column: string): ForeignKeyBuilder;
1512
- /**
1513
- * Drop a foreign key constraint.
1514
- *
1515
- * Two calling forms:
1516
- *
1517
- * 1. Auto-compute the name (matches what `addForeignKey` generates):
1518
- * ```typescript
1519
- * this.dropForeign("unit_id", Unit.table);
1520
- * // → drops: fk_{table}_unit_id_units
1521
- * ```
1522
- *
1523
- * 2. Raw constraint name (use when the name was set explicitly):
1524
- * ```typescript
1525
- * this.dropForeign("my_custom_fk_name");
1526
- * ```
1527
- *
1528
- * @param columnOrConstraint - Column name (auto mode) or raw constraint name (raw mode)
1529
- * @param referencesTable - Referenced table name; triggers auto-name computation when provided
1530
- * @returns This migration for chaining
1531
- */
1532
- dropForeign(columnOrConstraint: string, referencesTable?: string): this;
1533
- /**
1534
- * Set JSON schema validation rules on the collection.
1535
- *
1536
- * MongoDB-only feature. SQL databases ignore this.
1537
- *
1538
- * @param schema - JSON Schema object
1539
- * @returns This migration for chaining
1540
- *
1541
- * @example
1542
- * ```typescript
1543
- * this.schemaValidation({
1544
- * bsonType: "object",
1545
- * required: ["name", "email"],
1546
- * properties: {
1547
- * name: { bsonType: "string" },
1548
- * email: { bsonType: "string" },
1549
- * },
1550
- * });
1551
- * ```
1552
- */
1553
- schemaValidation(schema: object): this;
1554
- /**
1555
- * Remove schema validation rules from the collection.
1556
- *
1557
- * @returns This migration for chaining
1558
- */
1559
- dropSchemaValidation(): this;
1560
- /**
1561
- * Execute raw operations with direct driver/connection access.
1562
- *
1563
- * Use this when you need to bypass the migration API entirely and
1564
- * interact with the native database driver directly.
1565
- *
1566
- * @param callback - Callback receiving the native connection
1567
- * @returns Result from callback
1568
- *
1569
- * @example
1570
- * ```typescript
1571
- * await this.withConnection(async (db) => {
1572
- * await db.collection("users").updateMany({}, { $set: { active: true } });
1573
- * });
1574
- * ```
1575
- */
1576
- withConnection<T>(callback: (connection: unknown) => Promise<T>): Promise<T>;
1577
- /**
1578
- * Queue a raw SQL string for execution within the migration.
1579
- *
1580
- * The statement is queued and executed in order with other migration
1581
- * operations, within the transaction context if the migration is transactional.
1582
- *
1583
- * Use `withConnection()` instead if you need direct driver access.
1584
- *
1585
- * Works with PostgreSQL, MySQL, etc. For MongoDB, uses $eval command.
1586
- *
1587
- * @param sql - SQL statement to execute
1588
- * @returns This migration for chaining
1589
- *
1590
- * @example
1591
- * ```typescript
1592
- * // Enable PostgreSQL extension
1593
- * this.raw('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"');
1594
- *
1595
- * // Create custom type
1596
- * this.raw('CREATE TYPE mood AS ENUM (\'happy\', \'sad\', \'neutral\')');
1597
- * ```
1598
- */
1599
- raw(sql: string): this;
1600
- /**
1601
- * Create a declarative initial-table migration.
1602
- * Implemented and assigned below the class body.
1603
- */
1604
- static create: (model: ChildModel<Model<any>>, columns: ColumnMap, options?: MigrationCreateOptions) => MigrationConstructor;
1605
- /**
1606
- * Create a declarative alteration migration.
1607
- * Implemented and assigned below the class body.
1608
- */
1609
- static alter: (model: ChildModel<Model<any>>, schema: AlterSchema, options?: MigrationAlterOptions) => MigrationConstructor;
1610
- }
1611
- export declare function migrate(model: ChildModel<Model<any>>, options?: {
1612
- createdAt?: string;
1613
- name?: string;
1614
- up?: (this: MigrationContract) => void | Promise<void>;
1615
- down?: (this: MigrationContract) => void | Promise<void>;
1616
- transactional?: boolean;
1617
- }): MigrationConstructor;
1618
- /**
1619
- * A single composite index entry for `Migration.create()` options.
1620
- *
1621
- * @example
1622
- * ```typescript
1623
- * // Simple — columns only, name and type auto-resolved
1624
- * { columns: ["organization_id", "content_type"] }
1625
- *
1626
- * // Named
1627
- * { columns: ["organization_id", "content_type"], name: "idx_org_content" }
1628
- *
1629
- * // Typed (PostgreSQL)
1630
- * { columns: ["embedding"], using: "ivfflat" }
1631
- * ```
1632
- */
1633
- export type IndexEntry = {
1634
- /** Column(s) to include in the index. */
1635
- columns: string | string[];
1636
- /** Optional explicit index name. Auto-generated when omitted. */
1637
- name?: string;
1638
- /**
1639
- * Index access method (PostgreSQL).
1640
- * Defaults to `"btree"` when omitted.
1641
- */
1642
- using?: "btree" | "hash" | "gin" | "gist" | "brin" | "ivfflat" | "hnsw" | (string & {});
1643
- /** Extra columns to include in a covering index (PostgreSQL `INCLUDE`). */
1644
- include?: string[];
1645
- /** Build the index without locking the table (PostgreSQL). */
1646
- concurrently?: boolean;
1647
- };
1648
- /**
1649
- * A single composite unique constraint entry for `Migration.create()` options.
1650
- *
1651
- * @example
1652
- * ```typescript
1653
- * // Simple
1654
- * { columns: ["organization_id", "email"] }
1655
- *
1656
- * // Named — useful when you need to reference it in a future ALTER
1657
- * { columns: ["org_id", "content_id", "lang"], name: "uq_summary_idempotency" }
1658
- * ```
1659
- */
1660
- export type UniqueEntry = {
1661
- /** Column(s) that must be unique together. */
1662
- columns: string | string[];
1663
- /** Optional explicit constraint name. Auto-generated when omitted. */
1664
- name?: string;
1665
- /** Extra columns to include (PostgreSQL covering unique index). */
1666
- include?: string[];
1667
- /** Build the constraint without locking the table (PostgreSQL). */
1668
- concurrently?: boolean;
1669
- };
1670
- /**
1671
- * Options accepted by `Migration.create()`.
1672
- */
1673
- export type MigrationCreateOptions = {
1674
- /**
1675
- * Sort order override.
1676
- * @default 0
1677
- */
1678
- order?: number;
1679
- /**
1680
- * ISO timestamp override for migration ordering.
1681
- * Normally extracted from the filename by the runner.
1682
- */
1683
- createdAt?: string;
1684
- /**
1685
- * Override the primary key type for this migration only.
1686
- *
1687
- * - `"uuid"` — UUID primary key (uses `primaryUuid()`)
1688
- * - `"int"` — Auto-increment integer (uses `id()`)
1689
- * - `"bigInt"` — Big auto-increment integer (uses `bigId()`)
1690
- * - `false` — Skip primary key generation entirely
1691
- *
1692
- * When omitted, falls back to `migrationDefaults.primaryKey` from the
1693
- * DataSource config, then to `"int"` as the framework default.
1694
- */
1695
- primaryKey?: "uuid" | "int" | "bigInt" | false;
1696
- /**
1697
- * Whether to add `timestamps()` (created_at / updated_at).
1698
- * @default true
1699
- */
1700
- timestamps?: boolean;
1701
- /**
1702
- * Whether to wrap this migration in a transaction.
1703
- * Falls back to DataSource / driver defaults when omitted.
1704
- */
1705
- transactional?: boolean;
1706
- /**
1707
- * Composite indexes to create on the table.
1708
- *
1709
- * Use this for multi-column indexes. Single-column indexes should be
1710
- * defined at the column level via `.index()`.
1711
- *
1712
- * @example
1713
- * ```typescript
1714
- * index: [
1715
- * { columns: ["organization_id", "content_type", "content_id"] },
1716
- * { columns: ["organization_id", "status"], name: "idx_org_status" },
1717
- * ]
1718
- * ```
1719
- */
1720
- index?: IndexEntry[];
1721
- /**
1722
- * Composite unique constraints to create on the table.
1723
- *
1724
- * Use this for multi-column uniqueness. Single-column unique constraints
1725
- * should be defined at the column level via `.unique()`.
1726
- *
1727
- * @example
1728
- * ```typescript
1729
- * unique: [
1730
- * {
1731
- * columns: ["organization_id", "content_id", "content_language"],
1732
- * name: "uq_summary_idempotency",
1733
- * },
1734
- * ]
1735
- * ```
1736
- */
1737
- unique?: UniqueEntry[];
1738
- /**
1739
- * Custom logic to execute after the declarative definitions.
1740
- * Useful for data seeding or raw SQL following table creation.
1741
- */
1742
- up?: (this: Migration) => void | Promise<void>;
1743
- /**
1744
- * Raw SQL queries to run before the custom `up` logic.
1745
- * Useful for triggering statements or custom constraints.
1746
- */
1747
- raw?: string | string[];
1748
- /**
1749
- * Custom rollback logic to execute before the default `dropTableIfExists`.
1750
- */
1751
- down?: (this: Migration) => void | Promise<void>;
1752
- };
1753
- /**
1754
- * Column map accepted by `Migration.create()` and `Migration.alter()`.
1755
- *
1756
- * Keys become the column names; values are `DetachedColumnBuilder` instances
1757
- * produced by the standalone column helpers (`uuid()`, `text()`, etc.).
1758
- */
1759
- export type ColumnMap = Record<string, import("./column-helpers").DetachedColumnBuilder>;
1760
- /**
1761
- * Options accepted by `Migration.alter()`.
1762
- */
1763
- export type MigrationAlterOptions = {
1764
- /** Sort order override. */
1765
- order?: number;
1766
- /** ISO timestamp override. */
1767
- createdAt?: string;
1768
- /** Whether to wrap in a transaction. */
1769
- transactional?: boolean;
1770
- /**
1771
- * Custom logic to execute after the declarative definitions.
1772
- */
1773
- up?: (this: Migration) => void | Promise<void>;
1774
- /**
1775
- * Custom rollback logic to execute on rollback.
1776
- * Unlike `create()`, `alter()` does not auto-infer rollbacks.
1777
- */
1778
- down?: (this: Migration) => void | Promise<void>;
1779
- };
1780
- /**
1781
- * Schema map passed to `Migration.alter()`.
1782
- *
1783
- * Groups all table-level DDL operations by intent.
1784
- * Any key can be omitted when not needed.
1785
- *
1786
- * @example
1787
- * ```typescript
1788
- * export default Migration.alter(User, {
1789
- * // Column operations
1790
- * add: { phone: text().nullable() },
1791
- * drop: ["legacy_column"],
1792
- * rename: { old_name: "new_name" },
1793
- * modify: { email: string(320).notNullable() },
1794
- *
1795
- * // Index / constraint operations
1796
- * addIndex: [{ columns: ["first_name", "last_name"] }],
1797
- * addUnique: [{ columns: ["email"] }],
1798
- * addForeign: [{ column: "team_id", references: Team }],
1799
- * dropIndexes: ["old_idx_name"],
1800
- * dropUnique: [["email"]],
1801
- * });
1802
- * ```
1803
- */
1804
- export type AlterSchema = {
1805
- /** Columns to add. Keys become column names. */
1806
- add?: ColumnMap;
1807
- /** Column names to drop. */
1808
- drop?: string[];
1809
- /** Rename map: `{ oldName: newName }`. */
1810
- rename?: Record<string, string>;
1811
- /** Columns to modify. Keys become column names. */
1812
- modify?: ColumnMap;
1813
- /**
1814
- * Regular indexes to add.
1815
- *
1816
- * @example
1817
- * ```typescript
1818
- * addIndex: [
1819
- * { columns: "email" },
1820
- * { columns: ["first_name", "last_name"], name: "idx_full_name" },
1821
- * { columns: "email", options: { concurrently: true } },
1822
- * ]
1823
- * ```
1824
- */
1825
- addIndex?: Array<{
1826
- columns: string | string[];
1827
- name?: string;
1828
- options?: {
1829
- include?: string[];
1830
- concurrently?: boolean;
1831
- };
1832
- }>;
1833
- /**
1834
- * Indexes to drop (by name or columns array).
1835
- *
1836
- * @example
1837
- * ```typescript
1838
- * dropIndex: ["idx_old_name", ["first_name", "last_name"]]
1839
- * ```
1840
- */
1841
- dropIndex?: Array<string | string[]>;
1842
- /**
1843
- * Unique constraints / indexes to add.
1844
- *
1845
- * @example
1846
- * ```typescript
1847
- * addUnique: [{ columns: "email" }]
1848
- * ```
1849
- */
1850
- addUnique?: Array<{
1851
- columns: string | string[];
1852
- name?: string;
1853
- options?: {
1854
- include?: string[];
1855
- concurrently?: boolean;
1856
- };
1857
- }>;
1858
- /**
1859
- * Unique constraints to drop (by columns array).
1860
- *
1861
- * @example
1862
- * ```typescript
1863
- * dropUnique: [["email"], ["phone"]]
1864
- * ```
1865
- */
1866
- dropUnique?: Array<string | string[]>;
1867
- /**
1868
- * Expression-based indexes to add (PostgreSQL-specific).
1869
- *
1870
- * @example
1871
- * ```typescript
1872
- * addExpressionIndex: [
1873
- * { expressions: "lower(email)", name: "idx_email_lower" },
1874
- * ]
1875
- * ```
1876
- */
1877
- addExpressionIndex?: Array<{
1878
- expressions: string | string[];
1879
- name?: string;
1880
- options?: {
1881
- concurrently?: boolean;
1882
- };
1883
- }>;
1884
- /**
1885
- * Full-text search indexes to add.
1886
- *
1887
- * @example
1888
- * ```typescript
1889
- * addFullText: [{ columns: ["title", "body"] }]
1890
- * ```
1891
- */
1892
- addFullText?: Array<{
1893
- columns: string | string[];
1894
- options?: FullTextIndexOptions;
1895
- }>;
1896
- /** Full-text indexes to drop (by name). */
1897
- dropFullText?: string[];
1898
- /**
1899
- * Geo-spatial indexes to add.
1900
- *
1901
- * @example
1902
- * ```typescript
1903
- * addGeoIndex: [{ column: "location" }]
1904
- * ```
1905
- */
1906
- addGeoIndex?: Array<{
1907
- column: string;
1908
- options?: GeoIndexOptions;
1909
- }>;
1910
- /** Geo indexes to drop (by column name). */
1911
- dropGeoIndex?: string[];
1912
- /**
1913
- * Vector search indexes to add.
1914
- *
1915
- * @example
1916
- * ```typescript
1917
- * addVectorIndex: [{ column: "embedding", options: { dimensions: 1536, similarity: "cosine" } }]
1918
- * ```
1919
- */
1920
- addVectorIndex?: Array<{
1921
- column: string;
1922
- options: VectorIndexOptions;
1923
- }>;
1924
- /** Vector indexes to drop (by column name). */
1925
- dropVectorIndex?: string[];
1926
- /**
1927
- * TTL indexes to add (MongoDB-primary).
1928
- *
1929
- * @example
1930
- * ```typescript
1931
- * addTTLIndex: [{ column: "created_at", expireAfterSeconds: 86400 }]
1932
- * ```
1933
- */
1934
- addTTLIndex?: Array<{
1935
- column: string;
1936
- expireAfterSeconds: number;
1937
- }>;
1938
- /** TTL indexes to drop (by column name). */
1939
- dropTTLIndex?: string[];
1940
- /**
1941
- * Foreign keys to add to existing columns.
1942
- *
1943
- * Accepts a Model class or a raw table-name string for `references`.
1944
- *
1945
- * @example
1946
- * ```typescript
1947
- * addForeign: [
1948
- * { column: "team_id", references: Team, onDelete: "cascade" },
1949
- * { column: "owner_id", references: "users", on: "id", onDelete: "setNull" },
1950
- * ]
1951
- * ```
1952
- */
1953
- addForeign?: Array<{
1954
- column: string;
1955
- references: string | {
1956
- table: string;
1957
- };
1958
- on?: string;
1959
- onDelete?: "cascade" | "restrict" | "setNull" | "noAction";
1960
- onUpdate?: "cascade" | "restrict" | "setNull" | "noAction";
1961
- }>;
1962
- /**
1963
- * Foreign keys to drop.
1964
- *
1965
- * Two forms:
1966
- * - `{ columnOrConstraint: "team_id", referencesTable: "teams" }` → auto-name resolution
1967
- * - `{ columnOrConstraint: "fk_my_custom_name" }` → raw constraint name
1968
- */
1969
- dropForeign?: Array<{
1970
- columnOrConstraint: string;
1971
- referencesTable?: string;
1972
- }>;
1973
- /**
1974
- * CHECK constraints to add.
1975
- *
1976
- * @example
1977
- * ```typescript
1978
- * addCheck: [{ name: "age_positive", expression: "age >= 0" }]
1979
- * ```
1980
- */
1981
- addCheck?: Array<{
1982
- name: string;
1983
- expression: string;
1984
- }>;
1985
- /** CHECK constraints to drop (by name). */
1986
- dropCheck?: string[];
1987
- /**
1988
- * Raw SQL queries to execute as part of this alter operation.
1989
- */
1990
- raw?: string | string[];
1991
- };
1992
- //# sourceMappingURL=migration.d.ts.map