@rvoh/dream 2.14.1 → 2.15.1

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 (217) hide show
  1. package/dist/cjs/src/Dream.js +3 -11
  2. package/dist/cjs/src/decorators/field/association/BelongsTo.js +28 -1
  3. package/dist/cjs/src/decorators/field/association/shared.js +20 -1
  4. package/dist/cjs/src/dream/LeftJoinLoadBuilder.js +8 -1
  5. package/dist/cjs/src/dream/QueryDriver/Kysely.js +6 -5
  6. package/dist/cjs/src/errors/associations/MissingRequiredBelongsToAssociation.js +84 -0
  7. package/dist/esm/src/Dream.js +3 -11
  8. package/dist/esm/src/decorators/field/association/BelongsTo.js +28 -1
  9. package/dist/esm/src/decorators/field/association/shared.js +20 -1
  10. package/dist/esm/src/dream/LeftJoinLoadBuilder.js +8 -1
  11. package/dist/esm/src/dream/QueryDriver/Kysely.js +6 -5
  12. package/dist/esm/src/errors/associations/MissingRequiredBelongsToAssociation.js +84 -0
  13. package/dist/types/src/dream/LeftJoinLoadBuilder.d.ts +1 -0
  14. package/dist/types/src/errors/associations/MissingRequiredBelongsToAssociation.d.ts +49 -0
  15. package/dist/types/src/types/dream.d.ts +9 -0
  16. package/dist/types/src/types/{dream.ts → types/dream.ts} +30 -0
  17. package/dist/types/src/types/{variadic.ts → types/variadic.ts} +28 -4
  18. package/dist/types/src/types/variadic.d.ts +9 -4
  19. package/docs/classes/db.DreamMigrationHelpers.html +11 -11
  20. package/docs/classes/db.KyselyQueryDriver.html +34 -34
  21. package/docs/classes/db.PostgresQueryDriver.html +35 -35
  22. package/docs/classes/db.QueryDriverBase.html +33 -33
  23. package/docs/classes/errors.CheckConstraintViolation.html +3 -3
  24. package/docs/classes/errors.ColumnOverflow.html +3 -3
  25. package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
  26. package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +3 -3
  27. package/docs/classes/errors.DataTypeColumnTypeMismatch.html +3 -3
  28. package/docs/classes/errors.DecryptionError.html +2 -2
  29. package/docs/classes/errors.DecryptionParseError.html +2 -2
  30. package/docs/classes/errors.DecryptionRotationError.html +3 -3
  31. package/docs/classes/errors.GlobalNameNotSet.html +3 -3
  32. package/docs/classes/errors.InvalidCalendarDate.html +2 -2
  33. package/docs/classes/errors.InvalidClockTime.html +2 -2
  34. package/docs/classes/errors.InvalidClockTimeTz.html +2 -2
  35. package/docs/classes/errors.InvalidDateTime.html +2 -2
  36. package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
  37. package/docs/classes/errors.NonLoadedAssociation.html +3 -3
  38. package/docs/classes/errors.NotNullViolation.html +3 -3
  39. package/docs/classes/errors.RecordNotFound.html +3 -3
  40. package/docs/classes/errors.ValidationError.html +3 -3
  41. package/docs/classes/index.CalendarDate.html +33 -33
  42. package/docs/classes/index.ClockTime.html +32 -32
  43. package/docs/classes/index.ClockTimeTz.html +35 -35
  44. package/docs/classes/index.DateTime.html +86 -86
  45. package/docs/classes/index.Decorators.html +19 -19
  46. package/docs/classes/index.Dream.html +118 -118
  47. package/docs/classes/index.DreamApp.html +10 -10
  48. package/docs/classes/index.DreamTransaction.html +2 -2
  49. package/docs/classes/index.Env.html +2 -2
  50. package/docs/classes/index.Query.html +57 -57
  51. package/docs/classes/system.CliFileWriter.html +4 -4
  52. package/docs/classes/system.DreamBin.html +2 -2
  53. package/docs/classes/system.DreamCLI.html +7 -7
  54. package/docs/classes/system.DreamImporter.html +2 -2
  55. package/docs/classes/system.DreamLogos.html +2 -2
  56. package/docs/classes/system.DreamSerializerBuilder.html +11 -11
  57. package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
  58. package/docs/classes/system.PathHelpers.html +3 -3
  59. package/docs/classes/utils.Encrypt.html +3 -3
  60. package/docs/classes/utils.Range.html +2 -2
  61. package/docs/functions/db.closeAllDbConnections.html +1 -1
  62. package/docs/functions/db.dreamDbConnections.html +1 -1
  63. package/docs/functions/db.untypedDb.html +1 -1
  64. package/docs/functions/db.validateColumn.html +1 -1
  65. package/docs/functions/db.validateTable.html +1 -1
  66. package/docs/functions/errors.pgErrorType.html +1 -1
  67. package/docs/functions/index.DreamSerializer.html +1 -1
  68. package/docs/functions/index.ObjectSerializer.html +1 -1
  69. package/docs/functions/index.ReplicaSafe.html +1 -1
  70. package/docs/functions/index.STI.html +1 -1
  71. package/docs/functions/index.SoftDelete.html +1 -1
  72. package/docs/functions/utils.camelize.html +1 -1
  73. package/docs/functions/utils.capitalize.html +1 -1
  74. package/docs/functions/utils.cloneDeepSafe.html +1 -1
  75. package/docs/functions/utils.compact.html +1 -1
  76. package/docs/functions/utils.groupBy.html +1 -1
  77. package/docs/functions/utils.hyphenize.html +1 -1
  78. package/docs/functions/utils.intersection.html +1 -1
  79. package/docs/functions/utils.isEmpty.html +1 -1
  80. package/docs/functions/utils.normalizeUnicode.html +1 -1
  81. package/docs/functions/utils.pascalize.html +1 -1
  82. package/docs/functions/utils.percent.html +1 -1
  83. package/docs/functions/utils.range.html +1 -1
  84. package/docs/functions/utils.round.html +1 -1
  85. package/docs/functions/utils.sanitizeString.html +1 -1
  86. package/docs/functions/utils.snakeify.html +1 -1
  87. package/docs/functions/utils.sort.html +1 -1
  88. package/docs/functions/utils.sortBy.html +1 -1
  89. package/docs/functions/utils.sortObjectByKey.html +1 -1
  90. package/docs/functions/utils.sortObjectByValue.html +1 -1
  91. package/docs/functions/utils.uncapitalize.html +1 -1
  92. package/docs/functions/utils.uniq.html +1 -1
  93. package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
  94. package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
  95. package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
  96. package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
  97. package/docs/interfaces/types.BelongsToStatement.html +2 -2
  98. package/docs/interfaces/types.DecoratorContext.html +2 -2
  99. package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
  100. package/docs/interfaces/types.DreamAppOpts.html +2 -2
  101. package/docs/interfaces/types.DreamDbConfig.html +5 -5
  102. package/docs/interfaces/types.DurationObject.html +2 -2
  103. package/docs/interfaces/types.EncryptOptions.html +2 -2
  104. package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
  105. package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
  106. package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
  107. package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
  108. package/docs/types/openapi.OpenapiAllTypes.html +1 -1
  109. package/docs/types/openapi.OpenapiFormats.html +1 -1
  110. package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
  111. package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
  112. package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
  113. package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
  114. package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
  115. package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
  116. package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
  117. package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
  118. package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
  119. package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +2 -2
  120. package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +2 -2
  121. package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +2 -2
  122. package/docs/types/openapi.OpenapiSchemaExpressionRef.html +2 -2
  123. package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +2 -2
  124. package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
  125. package/docs/types/openapi.OpenapiSchemaNull.html +2 -2
  126. package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
  127. package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
  128. package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
  129. package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
  130. package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
  131. package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  132. package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
  133. package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
  134. package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
  135. package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
  136. package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
  137. package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
  138. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +2 -2
  139. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +2 -2
  140. package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +2 -2
  141. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +2 -2
  142. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +2 -2
  143. package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  144. package/docs/types/openapi.OpenapiSchemaString.html +1 -1
  145. package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
  146. package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
  147. package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
  148. package/docs/types/openapi.OpenapiTypeField.html +1 -1
  149. package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
  150. package/docs/types/types.CalendarDateDurationUnit.html +1 -1
  151. package/docs/types/types.CalendarDateObject.html +1 -1
  152. package/docs/types/types.Camelized.html +1 -1
  153. package/docs/types/types.ClockTimeObject.html +1 -1
  154. package/docs/types/types.DbConnectionType.html +1 -1
  155. package/docs/types/types.DbTypes.html +1 -1
  156. package/docs/types/types.DreamAssociationMetadata.html +1 -1
  157. package/docs/types/types.DreamAttributes.html +1 -1
  158. package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
  159. package/docs/types/types.DreamClassColumn.html +1 -1
  160. package/docs/types/types.DreamColumn.html +1 -1
  161. package/docs/types/types.DreamColumnNames.html +1 -1
  162. package/docs/types/types.DreamLogLevel.html +1 -1
  163. package/docs/types/types.DreamLogger.html +2 -2
  164. package/docs/types/types.DreamModelSerializerType.html +1 -1
  165. package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
  166. package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
  167. package/docs/types/types.DreamParamSafeAttributes.html +1 -1
  168. package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
  169. package/docs/types/types.DreamSerializable.html +1 -1
  170. package/docs/types/types.DreamSerializableArray.html +1 -1
  171. package/docs/types/types.DreamSerializerKey.html +1 -1
  172. package/docs/types/types.DreamSerializers.html +1 -1
  173. package/docs/types/types.DreamVirtualColumns.html +1 -1
  174. package/docs/types/types.DurationUnit.html +1 -1
  175. package/docs/types/types.EncryptAlgorithm.html +1 -1
  176. package/docs/types/types.HasManyStatement.html +1 -1
  177. package/docs/types/types.HasOneStatement.html +1 -1
  178. package/docs/types/types.Hyphenized.html +1 -1
  179. package/docs/types/types.Pascalized.html +1 -1
  180. package/docs/types/types.PrimaryKeyType.html +1 -1
  181. package/docs/types/types.RoundingPrecision.html +1 -1
  182. package/docs/types/types.SerializerCasing.html +1 -1
  183. package/docs/types/types.SimpleObjectSerializerType.html +1 -1
  184. package/docs/types/types.Snakeified.html +1 -1
  185. package/docs/types/types.StrictInterface.html +1 -1
  186. package/docs/types/types.UpdateableAssociationProperties.html +1 -1
  187. package/docs/types/types.UpdateableProperties.html +1 -1
  188. package/docs/types/types.ValidationType.html +1 -1
  189. package/docs/types/types.ViewModel.html +2 -2
  190. package/docs/types/types.ViewModelClass.html +1 -1
  191. package/docs/types/types.WeekdayName.html +1 -1
  192. package/docs/types/types.WhereStatementForDream.html +1 -1
  193. package/docs/types/types.WhereStatementForDreamClass.html +1 -1
  194. package/docs/variables/index.DreamConst.html +1 -1
  195. package/docs/variables/index.ops.html +1 -1
  196. package/docs/variables/openapi.openapiPrimitiveTypes.html +1 -1
  197. package/docs/variables/openapi.openapiShorthandPrimitiveTypes.html +1 -1
  198. package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
  199. package/docs/variables/system.primaryKeyTypes.html +1 -1
  200. package/package.json +4 -1
  201. /package/dist/types/src/types/{associations → types/associations}/belongsTo.ts +0 -0
  202. /package/dist/types/src/types/{associations → types/associations}/hasMany.ts +0 -0
  203. /package/dist/types/src/types/{associations → types/associations}/hasOne.ts +0 -0
  204. /package/dist/types/src/types/{associations → types/associations}/shared.ts +0 -0
  205. /package/dist/types/src/types/{calendardate.ts → types/calendardate.ts} +0 -0
  206. /package/dist/types/src/types/{clocktime.ts → types/clocktime.ts} +0 -0
  207. /package/dist/types/src/types/{datetime.ts → types/datetime.ts} +0 -0
  208. /package/dist/types/src/types/{db.ts → types/db.ts} +0 -0
  209. /package/dist/types/src/types/{lifecycle.ts → types/lifecycle.ts} +0 -0
  210. /package/dist/types/src/types/{logger.ts → types/logger.ts} +0 -0
  211. /package/dist/types/src/types/{moduleDeclarations → types/moduleDeclarations}/luxon.d.ts +0 -0
  212. /package/dist/types/src/types/{openapi.ts → types/openapi.ts} +0 -0
  213. /package/dist/types/src/types/{query.ts → types/query.ts} +0 -0
  214. /package/dist/types/src/types/{recursiveSerialization.ts → types/recursiveSerialization.ts} +0 -0
  215. /package/dist/types/src/types/{serializer.ts → types/serializer.ts} +0 -0
  216. /package/dist/types/src/types/{utils.ts → types/utils.ts} +0 -0
  217. /package/dist/types/src/types/{validation.ts → types/validation.ts} +0 -0
@@ -7,6 +7,7 @@ import {
7
7
  AssociationTableName,
8
8
  AssociationTableNamesForAssociation,
9
9
  DreamAssociationNameToAssociatedModel,
10
+ IsNonOptionalBelongsToAssociation,
10
11
  JoinAndStatements,
11
12
  MAX_VARIADIC_DEPTH,
12
13
  RequiredOnClauseKeys,
@@ -344,6 +345,14 @@ type VariadicRecurse<
344
345
  ? RequiredOnClauseKeys<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName>
345
346
  : RequiredOnClauseKeys<Schema, PreviousConcreteTableName, ConcreteAssociationName>,
346
347
  //
348
+ // True when the just-consumed association is a non-optional (required)
349
+ // BelongsTo. The hydrating load variants forbid a trailing constraint on such
350
+ // an association, because the constraint could filter out the parent and null
351
+ // a value the generated OpenAPI spec declares non-nullable.
352
+ CurrentAssociationIsNonOptionalBelongsTo = IsAssociationNameOrAlias extends true
353
+ ? IsNonOptionalBelongsToAssociation<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName>
354
+ : IsNonOptionalBelongsToAssociation<Schema, PreviousConcreteTableName, ConcreteAssociationName>,
355
+ //
347
356
  AllowedNextArgValues = RecursionType extends 'load'
348
357
  ? AllowedNextArgValuesForLoad<
349
358
  DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>,
@@ -351,7 +360,8 @@ type VariadicRecurse<
351
360
  Schema,
352
361
  AllowedAssociationNames,
353
362
  AssociationTableOrConcreteTable,
354
- CurrentRequiredOnClauseKeys
363
+ CurrentRequiredOnClauseKeys,
364
+ CurrentAssociationIsNonOptionalBelongsTo
355
365
  >
356
366
  : RecursionType extends 'leftJoinLoad'
357
367
  ? AllowedNextArgValuesForLeftJoinLoad<
@@ -361,7 +371,8 @@ type VariadicRecurse<
361
371
  AllowedAssociationNames,
362
372
  AssociationTableOrConcreteTable,
363
373
  CurrentRequiredOnClauseKeys,
364
- NextUsedNamespaces
374
+ NextUsedNamespaces,
375
+ CurrentAssociationIsNonOptionalBelongsTo
365
376
  >
366
377
  : RecursionType extends 'join'
367
378
  ? AllowedNextArgValuesForJoin<
@@ -393,6 +404,13 @@ type VariadicRecurse<
393
404
  : LastDream
394
405
  >
395
406
 
407
+ /**
408
+ * Error string surfaced when a trailing load-time constraint is applied to a
409
+ * non-optional BelongsTo association in a hydrating load variant.
410
+ */
411
+ type CannotConstrainRequiredBelongsTo =
412
+ 'cannot apply a constraint to a required (non-optional) BelongsTo association'
413
+
396
414
  type AllowedNextArgValuesForLoad<
397
415
  I extends Dream,
398
416
  DB,
@@ -400,10 +418,13 @@ type AllowedNextArgValuesForLoad<
400
418
  AllowedNames,
401
419
  TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB,
402
420
  RequiredOnClauseKeysForThisAssociation,
421
+ IsNonOptionalBelongsTo,
403
422
  > =
404
423
  | AllowedNames
405
424
  | AllowedNames[]
406
- | JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>
425
+ | (IsNonOptionalBelongsTo extends true
426
+ ? CannotConstrainRequiredBelongsTo
427
+ : JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>)
407
428
 
408
429
  type AllowedNextArgValuesForLeftJoinLoad<
409
430
  I extends Dream,
@@ -413,10 +434,13 @@ type AllowedNextArgValuesForLeftJoinLoad<
413
434
  TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB,
414
435
  RequiredOnClauseKeysForThisAssociation,
415
436
  UsedNamespaces,
437
+ IsNonOptionalBelongsTo,
416
438
  > =
417
439
  | Exclude<AllowedNames, UsedNamespaces>
418
440
  | Exclude<AllowedNames, UsedNamespaces>[]
419
- | JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>
441
+ | (IsNonOptionalBelongsTo extends true
442
+ ? CannotConstrainRequiredBelongsTo
443
+ : JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>)
420
444
 
421
445
  type AllowedNextArgValuesForJoin<
422
446
  I extends Dream,
@@ -1,7 +1,7 @@
1
1
  import Dream from '../Dream.js';
2
2
  import { Camelized } from '../helpers/stringCasing.js';
3
3
  import { AssociationTableNames } from './db.js';
4
- import { AssociationNamesForAssociation, AssociationNamesForTable, AssociationTableName, AssociationTableNamesForAssociation, DreamAssociationNameToAssociatedModel, JoinAndStatements, MAX_VARIADIC_DEPTH, RequiredOnClauseKeys } from './dream.js';
4
+ import { AssociationNamesForAssociation, AssociationNamesForTable, AssociationTableName, AssociationTableNamesForAssociation, DreamAssociationNameToAssociatedModel, IsNonOptionalBelongsToAssociation, JoinAndStatements, MAX_VARIADIC_DEPTH, RequiredOnClauseKeys } from './dream.js';
5
5
  import { Inc, ReadonlyTail } from './utils.js';
6
6
  type VALID = 'valid';
7
7
  type INVALID = 'invalid';
@@ -23,9 +23,14 @@ export type VariadicJoinsArgs<I extends Dream, DB, Schema, ConcreteTableName ext
23
23
  type VariadicCheckThenRecurse<I extends Dream, DB, Schema, ConcreteTableName extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, ConcreteArgs extends readonly unknown[], RecursionType extends RecursionTypes, UsedNamespaces, Depth extends number, PreviousConcreteTableName, ConcreteAssociationName, AssociationNamesOrOnClause, LastDream extends Dream = I, SchemaAssociations = Schema[ConcreteTableName]['associations' & keyof Schema[ConcreteTableName]], AllowedNamesForArrayArg = PreviousConcreteTableName extends keyof Schema ? AssociationNamesForAssociation<Schema, PreviousConcreteTableName, ConcreteAssociationName> : keyof SchemaAssociations & string, NthArgument extends VALID | INVALID = ConcreteArgs['length'] extends 0 ? VALID : ConcreteArgs[0] extends keyof SchemaAssociations & string ? VALID : ConcreteArgs[0] extends AliasedSchemaAssociation<Schema, ConcreteTableName> ? VALID : ConcreteArgs[0] extends JoinAndStatements<LastDream, DB, Schema, ConcreteTableName, RequiredOnClauseKeys<Schema, PreviousConcreteTableName, ConcreteAssociationName>> ? VALID : ConcreteArgs[0] extends readonly AllowedNamesForArrayArg[] ? VALID : ConcreteArgs[0] extends JoinAndStatements<LastDream, DB, Schema, ConcreteTableName, RequiredOnClauseKeys<Schema, PreviousConcreteTableName, ConcreteAssociationName>> ? VALID : ConcreteArgs[0] extends AllowedNamesForArrayArg ? VALID : INVALID> = NthArgument extends INVALID ? `invalid where clause in argument ${Inc<Depth>}` : ConcreteArgs['length'] extends 0 ? AssociationNamesOrOnClause : VariadicRecurse<I, DB, Schema, ConcreteTableName, ConcreteArgs, RecursionType, UsedNamespaces, Depth, PreviousConcreteTableName, ConcreteAssociationName, LastDream>;
24
24
  export type AliasedSchemaAssociation<Schema, ConcreteTableName extends keyof Schema, SchemaAssociations = Schema[ConcreteTableName]['associations' & keyof Schema[ConcreteTableName]]> = `${keyof SchemaAssociations & string} as ${string}`;
25
25
  type VariadicRecurse<I extends Dream, DB, Schema, ConcreteTableName extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, ConcreteArgs extends readonly unknown[], RecursionType extends RecursionTypes, UsedNamespaces, Depth extends number, PreviousConcreteTableName, ConcreteAssociationName, LastDream extends Dream, SchemaAssociations = Schema[ConcreteTableName]['associations' & keyof Schema[ConcreteTableName]], PolymorphicTableNamesUnion = PreviousConcreteTableName extends keyof Schema ? AssociationTableNamesForAssociation<Schema, PreviousConcreteTableName, ConcreteAssociationName> : ConcreteTableName, CrossPolymorphicTableForCurrentArg = ConcreteArgs[0] extends string ? TableContainingAssociationInUnion<Schema, PolymorphicTableNamesUnion, ConcreteArgs[0]> : never, EffectiveConcreteTableName extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB = ConcreteArgs[0] extends keyof SchemaAssociations & string ? ConcreteTableName : [CrossPolymorphicTableForCurrentArg] extends [never] ? ConcreteTableName : CrossPolymorphicTableForCurrentArg extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB ? CrossPolymorphicTableForCurrentArg : ConcreteTableName, EffectiveSchemaAssociations = Schema[EffectiveConcreteTableName]['associations' & keyof Schema[EffectiveConcreteTableName]], ConcreteNthArg extends (keyof SchemaAssociations & string) | (keyof EffectiveSchemaAssociations & string) | AliasedSchemaAssociation<Schema, ConcreteTableName> | null = ConcreteArgs[0] extends undefined ? null : ConcreteArgs[0] extends null ? null : ConcreteArgs[0] extends keyof SchemaAssociations & string ? ConcreteArgs[0] & keyof SchemaAssociations & string : ConcreteArgs[0] extends AliasedSchemaAssociation<Schema, ConcreteTableName> ? ConcreteArgs[0] & AliasedSchemaAssociation<Schema, ConcreteTableName> : ConcreteArgs[0] extends keyof EffectiveSchemaAssociations & string ? ConcreteArgs[0] & keyof EffectiveSchemaAssociations & string : null, NextUsedNamespaces = ConcreteArgs[0] extends undefined ? never : ConcreteArgs[0] extends null ? never : ConcreteNthArg extends null ? UsedNamespaces : UsedNamespaces | ConcreteNthArg, CurrentArgumentType extends IS_ASSOCIATION_NAME | IS_ASSOCIATION_ALIAS | IS_CROSS_POLYMORPHIC_ASSOCIATION_NAME | IS_NOT_ASSOCIATION_NAME = ConcreteNthArg extends null ? IS_NOT_ASSOCIATION_NAME : ConcreteNthArg extends keyof SchemaAssociations & string ? IS_ASSOCIATION_NAME : ConcreteNthArg extends AliasedSchemaAssociation<Schema, ConcreteTableName> ? IS_ASSOCIATION_ALIAS : ConcreteNthArg extends keyof EffectiveSchemaAssociations & string ? IS_CROSS_POLYMORPHIC_ASSOCIATION_NAME : IS_NOT_ASSOCIATION_NAME, NextPreviousConcreteTableName = CurrentArgumentType extends IS_ASSOCIATION_NAME ? ConcreteTableName : CurrentArgumentType extends IS_ASSOCIATION_ALIAS ? ConcreteTableName : CurrentArgumentType extends IS_CROSS_POLYMORPHIC_ASSOCIATION_NAME ? EffectiveConcreteTableName : PreviousConcreteTableName, NextUnaliasedAssociationName = CurrentArgumentType extends IS_ASSOCIATION_NAME ? ConcreteNthArg : CurrentArgumentType extends IS_ASSOCIATION_ALIAS ? ConcreteNthArg extends `${infer AssocName extends string} as ${string}` ? AssocName & keyof SchemaAssociations & string : never : CurrentArgumentType extends IS_CROSS_POLYMORPHIC_ASSOCIATION_NAME ? ConcreteNthArg : never, NextAliasedAssociationName = CurrentArgumentType extends IS_ASSOCIATION_NAME ? ConcreteNthArg : CurrentArgumentType extends IS_ASSOCIATION_ALIAS ? ConcreteNthArg extends `${string} as ${infer AssocAlias extends string}` ? AssocAlias & string : ConcreteAssociationName : CurrentArgumentType extends IS_CROSS_POLYMORPHIC_ASSOCIATION_NAME ? ConcreteNthArg : ConcreteAssociationName, IsAssociationNameOrAlias extends boolean = CurrentArgumentType extends IS_ASSOCIATION_NAME | IS_ASSOCIATION_ALIAS | IS_CROSS_POLYMORPHIC_ASSOCIATION_NAME ? true : false, NextTableName extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB = IsAssociationNameOrAlias extends true ? AssociationTableName<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : ConcreteTableName & AssociationTableNames<DB, Schema> & keyof DB, AllowedAssociationNames = IsAssociationNameOrAlias extends true ? AssociationNamesForAssociation<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : PreviousConcreteTableName extends keyof Schema ? AssociationNamesForAssociation<Schema, PreviousConcreteTableName, ConcreteAssociationName> : AssociationNamesForTable<Schema, ConcreteTableName>, // fall back to association names for table for root only
26
- AssociationTableOrConcreteTable extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB = IsAssociationNameOrAlias extends true ? AssociationTableName<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : ConcreteTableName, CurrentRequiredOnClauseKeys = IsAssociationNameOrAlias extends true ? RequiredOnClauseKeys<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : RequiredOnClauseKeys<Schema, PreviousConcreteTableName, ConcreteAssociationName>, AllowedNextArgValues = RecursionType extends 'load' ? AllowedNextArgValuesForLoad<DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>, DB, Schema, AllowedAssociationNames, AssociationTableOrConcreteTable, CurrentRequiredOnClauseKeys> : RecursionType extends 'leftJoinLoad' ? AllowedNextArgValuesForLeftJoinLoad<DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>, DB, Schema, AllowedAssociationNames, AssociationTableOrConcreteTable, CurrentRequiredOnClauseKeys, NextUsedNamespaces> : RecursionType extends 'join' ? AllowedNextArgValuesForJoin<DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>, DB, Schema, AllowedAssociationNames, AssociationTableOrConcreteTable, CurrentRequiredOnClauseKeys, NextUsedNamespaces> : never> = Depth extends MAX_VARIADIC_DEPTH ? never : VariadicCheckThenRecurse<I, DB, Schema, NextTableName, ReadonlyTail<ConcreteArgs>, RecursionType, NextUsedNamespaces, Inc<Depth>, NextPreviousConcreteTableName, NextAliasedAssociationName, AllowedNextArgValues, DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream> extends Dream ? DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream> : LastDream>;
27
- type AllowedNextArgValuesForLoad<I extends Dream, DB, Schema, AllowedNames, TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation> = AllowedNames | AllowedNames[] | JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>;
28
- type AllowedNextArgValuesForLeftJoinLoad<I extends Dream, DB, Schema, AllowedNames, TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation, UsedNamespaces> = Exclude<AllowedNames, UsedNamespaces> | Exclude<AllowedNames, UsedNamespaces>[] | JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>;
26
+ AssociationTableOrConcreteTable extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB = IsAssociationNameOrAlias extends true ? AssociationTableName<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : ConcreteTableName, CurrentRequiredOnClauseKeys = IsAssociationNameOrAlias extends true ? RequiredOnClauseKeys<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : RequiredOnClauseKeys<Schema, PreviousConcreteTableName, ConcreteAssociationName>, CurrentAssociationIsNonOptionalBelongsTo = IsAssociationNameOrAlias extends true ? IsNonOptionalBelongsToAssociation<Schema, EffectiveConcreteTableName, NextUnaliasedAssociationName> : IsNonOptionalBelongsToAssociation<Schema, PreviousConcreteTableName, ConcreteAssociationName>, AllowedNextArgValues = RecursionType extends 'load' ? AllowedNextArgValuesForLoad<DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>, DB, Schema, AllowedAssociationNames, AssociationTableOrConcreteTable, CurrentRequiredOnClauseKeys, CurrentAssociationIsNonOptionalBelongsTo> : RecursionType extends 'leftJoinLoad' ? AllowedNextArgValuesForLeftJoinLoad<DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>, DB, Schema, AllowedAssociationNames, AssociationTableOrConcreteTable, CurrentRequiredOnClauseKeys, NextUsedNamespaces, CurrentAssociationIsNonOptionalBelongsTo> : RecursionType extends 'join' ? AllowedNextArgValuesForJoin<DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream>, DB, Schema, AllowedAssociationNames, AssociationTableOrConcreteTable, CurrentRequiredOnClauseKeys, NextUsedNamespaces> : never> = Depth extends MAX_VARIADIC_DEPTH ? never : VariadicCheckThenRecurse<I, DB, Schema, NextTableName, ReadonlyTail<ConcreteArgs>, RecursionType, NextUsedNamespaces, Inc<Depth>, NextPreviousConcreteTableName, NextAliasedAssociationName, AllowedNextArgValues, DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream> extends Dream ? DreamAssociationNameToAssociatedModel<LastDream, ConcreteArgs[0] & keyof LastDream> : LastDream>;
27
+ /**
28
+ * Error string surfaced when a trailing load-time constraint is applied to a
29
+ * non-optional BelongsTo association in a hydrating load variant.
30
+ */
31
+ type CannotConstrainRequiredBelongsTo = 'cannot apply a constraint to a required (non-optional) BelongsTo association';
32
+ type AllowedNextArgValuesForLoad<I extends Dream, DB, Schema, AllowedNames, TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation, IsNonOptionalBelongsTo> = AllowedNames | AllowedNames[] | (IsNonOptionalBelongsTo extends true ? CannotConstrainRequiredBelongsTo : JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>);
33
+ type AllowedNextArgValuesForLeftJoinLoad<I extends Dream, DB, Schema, AllowedNames, TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation, UsedNamespaces, IsNonOptionalBelongsTo> = Exclude<AllowedNames, UsedNamespaces> | Exclude<AllowedNames, UsedNamespaces>[] | (IsNonOptionalBelongsTo extends true ? CannotConstrainRequiredBelongsTo : JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>);
29
34
  type AllowedNextArgValuesForJoin<I extends Dream, DB, Schema, AllowedNames, TableForJoin extends keyof Schema & AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation, UsedNamespaces> = Exclude<AllowedNames, UsedNamespaces> | JoinAndStatements<I, DB, Schema, TableForJoin, RequiredOnClauseKeysForThisAssociation>;
30
35
  export interface JoinedAssociation {
31
36
  table: string;
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>DreamMigrationHelpers | @rvoh/dream</title><meta name="description" content="Documentation for @rvoh/dream"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@rvoh/dream</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/db.html">db</a></li><li><a href="" aria-current="page">DreamMigrationHelpers</a></li></ul><h1>Class DreamMigrationHelpers</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L4">src/db/migration-helpers/DreamMigrationHelpers.ts:4</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h5 class="tsd-index-heading uppercase">Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>DreamMigrationHelpers | @rvoh/dream</title><meta name="description" content="Documentation for @rvoh/dream"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@rvoh/dream</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/db.html">db</a></li><li><a href="" aria-current="page">DreamMigrationHelpers</a></li></ul><h1>Class DreamMigrationHelpers</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L4">src/db/migration-helpers/DreamMigrationHelpers.ts:4</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h5 class="tsd-index-heading uppercase">Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
2
2
  </div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="#adddeferrableuniqueconstraint" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Deferrable<wbr/>Unique<wbr/>Constraint</span></a>
3
3
  <a href="#addenumvalue" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Enum<wbr/>Value</span></a>
4
4
  <a href="#createextension" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Extension</span></a>
@@ -18,13 +18,13 @@ indexes.</p>
18
18
  </div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">columns</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
19
19
  </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">columns</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><p>The names of the columns to include in the constraint</p>
20
20
  </div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The name of the table</p>
21
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L49">src/db/migration-helpers/DreamMigrationHelpers.ts:49</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="addenumvalue"><code class="tsd-tag">Static</code><span>add<wbr/>Enum<wbr/>Value</span><a href="#addenumvalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="addenumvalue-1"><span class="tsd-kind-call-signature">addEnumValue</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AddValueToEnumOpts</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#addenumvalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Add a value to an enum.</p>
21
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L49">src/db/migration-helpers/DreamMigrationHelpers.ts:49</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="addenumvalue"><code class="tsd-tag">Static</code><span>add<wbr/>Enum<wbr/>Value</span><a href="#addenumvalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="addenumvalue-1"><span class="tsd-kind-call-signature">addEnumValue</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AddValueToEnumOpts</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#addenumvalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Add a value to an enum.</p>
22
22
  <p>Note that this always includes &quot;IF NOT EXISTS&quot;, so is safe to re-run multiple times.</p>
23
23
  </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">db</span>: <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
24
24
  </div></li><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <span class="tsd-signature-type">AddValueToEnumOpts</span></span><div class="tsd-comment tsd-typography"><p>The options for adding the enum value</p>
25
25
  </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span>enumName</span></h5><div class="tsd-comment tsd-typography"><p>The name of the enum to modify</p>
26
26
  </div></li><li class="tsd-parameter"><h5><span>value</span></h5><div class="tsd-comment tsd-typography"><p>The name of the value to add to the enum</p>
27
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L79">src/db/migration-helpers/DreamMigrationHelpers.ts:79</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="createextension"><code class="tsd-tag">Static</code><span>create<wbr/>Extension</span><a href="#createextension" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="createextension-1"><span class="tsd-kind-call-signature">createExtension</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">extensionName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">ifNotExists</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">publicSchema</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#createextension-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a database extension.</p>
27
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L79">src/db/migration-helpers/DreamMigrationHelpers.ts:79</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="createextension"><code class="tsd-tag">Static</code><span>create<wbr/>Extension</span><a href="#createextension" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="createextension-1"><span class="tsd-kind-call-signature">createExtension</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">extensionName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">ifNotExists</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">publicSchema</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#createextension-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a database extension.</p>
28
28
  <pre><code><span class="hl-1"> </span><span class="hl-7">// Add the case insensitive extension</span><br/><span class="hl-1"> </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">DreamMigrationHelpers</span><span class="hl-1">.</span><span class="hl-5">createExtension</span><span class="hl-1">(</span><span class="hl-4">db</span><span class="hl-1">, </span><span class="hl-6">&#39;citext&#39;</span><span class="hl-1">)</span><br/><br/><span class="hl-1"> </span><span class="hl-7">// Add the pg trigram extension</span><br/><span class="hl-1"> </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">DreamMigrationHelpers</span><span class="hl-1">.</span><span class="hl-5">createExtension</span><span class="hl-1">(</span><span class="hl-4">db</span><span class="hl-1">, </span><span class="hl-6">&#39;pg_trgm&#39;</span><span class="hl-1">)</span>
29
29
  </code><button>Copy</button></pre>
30
30
 
@@ -33,13 +33,13 @@ indexes.</p>
33
33
  </div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">ifNotExists</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">publicSchema</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
34
34
  </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">ifNotExists</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>Only add the extension if it doesn't already exist</p>
35
35
  </div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">publicSchema</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>Create using the public schema</p>
36
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L101">src/db/migration-helpers/DreamMigrationHelpers.ts:101</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="createginindex"><code class="tsd-tag">Static</code><span>create<wbr/>Gin<wbr/>Index</span><a href="#createginindex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="createginindex-1"><span class="tsd-kind-call-signature">createGinIndex</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">indexName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">column</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#createginindex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a gin index</p>
36
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L101">src/db/migration-helpers/DreamMigrationHelpers.ts:101</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="createginindex"><code class="tsd-tag">Static</code><span>create<wbr/>Gin<wbr/>Index</span><a href="#createginindex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="createginindex-1"><span class="tsd-kind-call-signature">createGinIndex</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">indexName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">column</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#createginindex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a gin index</p>
37
37
  </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">db</span>: <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
38
38
  </div></li><li><span><span class="tsd-kind-parameter">indexName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The name of the constraint to create</p>
39
39
  </div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">column</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
40
40
  </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">column</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The name of the column to index</p>
41
41
  </div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The name of the table</p>
42
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L123">src/db/migration-helpers/DreamMigrationHelpers.ts:123</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="decryptcolumn"><code class="tsd-tag">Static</code><span>decrypt<wbr/>Column</span><a href="#decryptcolumn" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="decryptcolumn-1"><span class="tsd-kind-call-signature">decryptColumn</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">DecryptColumnOpts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#decryptcolumn-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Inverse of <a href="#encryptcolumn" class="tsd-kind-method">DreamMigrationHelpers.encryptColumn</a>: decrypt an
42
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L123">src/db/migration-helpers/DreamMigrationHelpers.ts:123</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="decryptcolumn"><code class="tsd-tag">Static</code><span>decrypt<wbr/>Column</span><a href="#decryptcolumn" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="decryptcolumn-1"><span class="tsd-kind-call-signature">decryptColumn</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">DecryptColumnOpts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#decryptcolumn-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Inverse of <a href="#encryptcolumn" class="tsd-kind-method">DreamMigrationHelpers.encryptColumn</a>: decrypt an
43
43
  <code>encrypted_&lt;column&gt;</code> column back to plaintext and rename it to <code>column</code>.</p>
44
44
  <p>Every non-null value is decrypted with the same path the decorator's getter uses
45
45
  (<code>InternalEncrypt.decryptColumn</code>, which honors both the <code>current</code> and <code>legacy</code>
@@ -60,20 +60,20 @@ recovered from the encrypted state. Pass <code>columnType</code> to restore a sp
60
60
  </div></li><li class="tsd-parameter"><h5><span>primaryKey</span></h5><div class="tsd-comment tsd-typography"><p>The primary key column used to keyset-paginate and target each row's update. Defaults to <code>id</code>.</p>
61
61
  </div></li><li class="tsd-parameter"><h5><span>batchSize</span></h5><div class="tsd-comment tsd-typography"><p>How many rows to read per batch. Defaults to <code>1000</code>.</p>
62
62
  </div></li><li class="tsd-parameter"><h5><span>columnType</span></h5><div class="tsd-comment tsd-typography"><p>When provided, the restored column is converted to this type. When omitted, the column is left as <code>text</code>.</p>
63
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L346">src/db/migration-helpers/DreamMigrationHelpers.ts:346</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="dropconstraint"><code class="tsd-tag">Static</code><span>drop<wbr/>Constraint</span><a href="#dropconstraint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="dropconstraint-1"><span class="tsd-kind-call-signature">dropConstraint</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">constraintName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#dropconstraint-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop a constraint</p>
63
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L346">src/db/migration-helpers/DreamMigrationHelpers.ts:346</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="dropconstraint"><code class="tsd-tag">Static</code><span>drop<wbr/>Constraint</span><a href="#dropconstraint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="dropconstraint-1"><span class="tsd-kind-call-signature">dropConstraint</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">constraintName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#dropconstraint-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop a constraint</p>
64
64
  <p>Note that this always includes &quot;IF NOT EXISTS&quot;, so is safe to re-run multiple times.</p>
65
65
  </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">db</span>: <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
66
66
  </div></li><li><span><span class="tsd-kind-parameter">constraintName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The name of the constraint to create</p>
67
67
  </div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
68
68
  </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">table</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The name of the table</p>
69
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L146">src/db/migration-helpers/DreamMigrationHelpers.ts:146</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="dropenumvalue"><code class="tsd-tag">Static</code><span>drop<wbr/>Enum<wbr/>Value</span><a href="#dropenumvalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="dropenumvalue-1"><span class="tsd-kind-call-signature">dropEnumValue</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">DropValueFromEnumOpts</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#dropenumvalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop a value from an enum and replace it with a different enum already
69
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L146">src/db/migration-helpers/DreamMigrationHelpers.ts:146</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="dropenumvalue"><code class="tsd-tag">Static</code><span>drop<wbr/>Enum<wbr/>Value</span><a href="#dropenumvalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="dropenumvalue-1"><span class="tsd-kind-call-signature">dropEnumValue</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">DropValueFromEnumOpts</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#dropenumvalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop a value from an enum and replace it with a different enum already
70
70
  present in the enum type (or optionally remove it from array columns).</p>
71
71
  </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">db</span>: <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
72
72
  </div></li><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <span class="tsd-signature-type">DropValueFromEnumOpts</span></span><div class="tsd-comment tsd-typography"><p>The options for dropping the enum value</p>
73
73
  </div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span>enumName</span></h5><div class="tsd-comment tsd-typography"><p>The name of the enum to modify</p>
74
74
  </div></li><li class="tsd-parameter"><h5><span>value</span></h5><div class="tsd-comment tsd-typography"><p>The name of the value to drop from the enum</p>
75
75
  </div></li><li class="tsd-parameter"><h5><span>replacements</span></h5><div class="tsd-comment tsd-typography"><p>Details about which table and column to change and which value to replace the dropped value with (or remove it if the column is an array)</p>
76
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L199">src/db/migration-helpers/DreamMigrationHelpers.ts:199</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="encryptcolumn"><code class="tsd-tag">Static</code><span>encrypt<wbr/>Column</span><a href="#encryptcolumn" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="encryptcolumn-1"><span class="tsd-kind-call-signature">encryptColumn</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EncryptColumnOpts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#encryptcolumn-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Convert an existing plaintext column into the encrypted-backed form expected by
76
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L199">src/db/migration-helpers/DreamMigrationHelpers.ts:199</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="encryptcolumn"><code class="tsd-tag">Static</code><span>encrypt<wbr/>Column</span><a href="#encryptcolumn" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="encryptcolumn-1"><span class="tsd-kind-call-signature">encryptColumn</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">EncryptColumnOpts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#encryptcolumn-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Convert an existing plaintext column into the encrypted-backed form expected by
77
77
  the <code>@Encrypted</code> decorator.</p>
78
78
  <p>This renames <code>column</code> to <code>encrypted_&lt;column&gt;</code>, widens it to <code>text</code>, and rewrites
79
79
  every non-null value with the AES-GCM ciphertext produced by the exact same code
@@ -106,7 +106,7 @@ queryable). Remove the index before this migration and do not re-add it.</p>
106
106
  </div></li><li class="tsd-parameter"><h5><span>encryptedColumnName</span></h5><div class="tsd-comment tsd-typography"><p>The target encrypted column name. Defaults to <code>encrypted_&lt;column&gt;</code>, matching the <code>@Encrypted</code> decorator's default; pass this when the decorator was given a custom encrypted column name.</p>
107
107
  </div></li><li class="tsd-parameter"><h5><span>primaryKey</span></h5><div class="tsd-comment tsd-typography"><p>The primary key column used to keyset-paginate and target each row's update. Defaults to <code>id</code>.</p>
108
108
  </div></li><li class="tsd-parameter"><h5><span>batchSize</span></h5><div class="tsd-comment tsd-typography"><p>How many rows to read per batch. Defaults to <code>1000</code>.</p>
109
- </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L290">src/db/migration-helpers/DreamMigrationHelpers.ts:290</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="newtransaction"><code class="tsd-tag">Static</code><span>new<wbr/>Transaction</span><a href="#newtransaction" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="newtransaction-1"><span class="tsd-kind-call-signature">newTransaction</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#newtransaction-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Forces a new transaction boundary in migration execution.</p>
109
+ </div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L290">src/db/migration-helpers/DreamMigrationHelpers.ts:290</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="newtransaction"><code class="tsd-tag">Static</code><span>new<wbr/>Transaction</span><a href="#newtransaction" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="newtransaction-1"><span class="tsd-kind-call-signature">newTransaction</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#newtransaction-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Forces a new transaction boundary in migration execution.</p>
110
110
  <p>When called in a migration file, this method ensures that any existing transaction
111
111
  is committed before this migration runs, and a new transaction is started before the
112
112
  migration in this file. This is essential for migrations that depend on previously
@@ -117,7 +117,7 @@ enum values to be committed to the database first.</p>
117
117
  <pre><code class="ts"><span class="hl-7">// first migration file: Add enum value</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-0">async</span><span class="hl-1"> </span><span class="hl-0">function</span><span class="hl-1"> </span><span class="hl-5">up</span><span class="hl-1">(</span><span class="hl-4">db</span><span class="hl-1">: </span><span class="hl-9">Kysely</span><span class="hl-1">&lt;</span><span class="hl-9">any</span><span class="hl-1">&gt;): </span><span class="hl-9">Promise</span><span class="hl-1">&lt;</span><span class="hl-9">void</span><span class="hl-1">&gt; {</span><br/><span class="hl-1"> </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">DreamMigrationHelpers</span><span class="hl-1">.</span><span class="hl-5">addEnumValue</span><span class="hl-1">(</span><span class="hl-4">db</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">enumName:</span><span class="hl-1"> </span><span class="hl-6">&#39;user_status&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">value:</span><span class="hl-1"> </span><span class="hl-6">&#39;premium&#39;</span><br/><span class="hl-1"> })</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-7">// second migration file: Add check constraint that depends on the enum value</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-0">async</span><span class="hl-1"> </span><span class="hl-0">function</span><span class="hl-1"> </span><span class="hl-5">up</span><span class="hl-1">(</span><span class="hl-4">db</span><span class="hl-1">: </span><span class="hl-9">Kysely</span><span class="hl-1">&lt;</span><span class="hl-9">any</span><span class="hl-1">&gt;): </span><span class="hl-9">Promise</span><span class="hl-1">&lt;</span><span class="hl-9">void</span><span class="hl-1">&gt; {</span><br/><span class="hl-1"> </span><span class="hl-4">DreamMigrationHelpers</span><span class="hl-1">.</span><span class="hl-5">newTransaction</span><span class="hl-1">() </span><span class="hl-7">// Ensure enum value is committed first</span><br/><br/><span class="hl-1"> </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">db</span><span class="hl-1">.</span><span class="hl-4">schema</span><br/><span class="hl-1"> .</span><span class="hl-5">alterTable</span><span class="hl-1">(</span><span class="hl-6">&#39;users&#39;</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-5">addCheckConstraint</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-6">&#39;check_premium_users&#39;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">sql</span><span class="hl-6">`status = &#39;premium&#39; OR credits &lt; 100`</span><br/><span class="hl-1"> )</span><br/><span class="hl-1"> .</span><span class="hl-5">execute</span><span class="hl-1">()</span><br/><span class="hl-1">}</span>
118
118
  </code><button type="button">Copy</button></pre>
119
119
 
120
- </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L187">src/db/migration-helpers/DreamMigrationHelpers.ts:187</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="renametable"><code class="tsd-tag">Static</code><span>rename<wbr/>Table</span><a href="#renametable" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="renametable-1"><span class="tsd-kind-call-signature">renameTable</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">from</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">to</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#renametable-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Rename a table and its associated primary key index and sequence.</p>
120
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L187">src/db/migration-helpers/DreamMigrationHelpers.ts:187</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="renametable"><code class="tsd-tag">Static</code><span>rename<wbr/>Table</span><a href="#renametable" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="renametable-1"><span class="tsd-kind-call-signature">renameTable</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">from</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">to</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#renametable-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Rename a table and its associated primary key index and sequence.</p>
121
121
  <p>This method renames the table, its primary key index (<code>{tablename}_pkey</code>),
122
122
  and its primary key sequence (<code>{tablename}_id_seq</code>) to keep them in sync.</p>
123
123
  <p>The sequence rename is skipped for tables with UUID primary keys (which have
@@ -126,4 +126,4 @@ PostgreSQL does not automatically rename it when the table is renamed.</p>
126
126
  </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">db</span>: <span class="tsd-signature-type">Kysely</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
127
127
  </div></li><li><span><span class="tsd-kind-parameter">from</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The current name of the table to rename</p>
128
128
  </div></li><li><span><span class="tsd-kind-parameter">to</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The new name for the table</p>
129
- </div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/72f4cfe2d4f270b103a88694bf557a5b4ad58eaa/src/db/migration-helpers/DreamMigrationHelpers.ts#L19">src/db/migration-helpers/DreamMigrationHelpers.ts:19</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#adddeferrableuniqueconstraint"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Deferrable<wbr/>Unique<wbr/>Constraint</span></a><a href="#addenumvalue"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Enum<wbr/>Value</span></a><a href="#createextension"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Extension</span></a><a href="#createginindex"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Gin<wbr/>Index</span></a><a href="#decryptcolumn"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>decrypt<wbr/>Column</span></a><a href="#dropconstraint"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Constraint</span></a><a href="#dropenumvalue"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Enum<wbr/>Value</span></a><a href="#encryptcolumn"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encrypt<wbr/>Column</span></a><a href="#newtransaction"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>new<wbr/>Transaction</span></a><a href="#renametable"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>rename<wbr/>Table</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@rvoh/dream</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
129
+ </div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/e599671a7dccc31e0f38b0999e6cc3f4d38a84fc/src/db/migration-helpers/DreamMigrationHelpers.ts#L19">src/db/migration-helpers/DreamMigrationHelpers.ts:19</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#adddeferrableuniqueconstraint"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Deferrable<wbr/>Unique<wbr/>Constraint</span></a><a href="#addenumvalue"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Enum<wbr/>Value</span></a><a href="#createextension"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Extension</span></a><a href="#createginindex"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Gin<wbr/>Index</span></a><a href="#decryptcolumn"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>decrypt<wbr/>Column</span></a><a href="#dropconstraint"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Constraint</span></a><a href="#dropenumvalue"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Enum<wbr/>Value</span></a><a href="#encryptcolumn"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encrypt<wbr/>Column</span></a><a href="#newtransaction"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>new<wbr/>Transaction</span></a><a href="#renametable"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>rename<wbr/>Table</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@rvoh/dream</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>