@warlock.js/cascade 4.0.174 → 4.1.2

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