@rvoh/dream 2.0.3 → 2.0.4
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.
- package/dist/cjs/src/cli/index.js +12 -12
- package/dist/esm/src/cli/index.js +12 -12
- package/docs/classes/db.DreamMigrationHelpers.html +9 -9
- package/docs/classes/db.KyselyQueryDriver.html +30 -30
- package/docs/classes/db.PostgresQueryDriver.html +31 -31
- package/docs/classes/db.QueryDriverBase.html +29 -29
- package/docs/classes/errors.CheckConstraintViolation.html +3 -3
- package/docs/classes/errors.ColumnOverflow.html +3 -3
- package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +3 -3
- package/docs/classes/errors.DataTypeColumnTypeMismatch.html +3 -3
- package/docs/classes/errors.GlobalNameNotSet.html +3 -3
- package/docs/classes/errors.InvalidCalendarDate.html +2 -2
- package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
- package/docs/classes/errors.NonLoadedAssociation.html +3 -3
- package/docs/classes/errors.NotNullViolation.html +3 -3
- package/docs/classes/errors.RecordNotFound.html +3 -3
- package/docs/classes/errors.ValidationError.html +3 -3
- package/docs/classes/index.CalendarDate.html +2 -2
- package/docs/classes/index.Decorators.html +19 -19
- package/docs/classes/index.Dream.html +113 -113
- package/docs/classes/index.DreamApp.html +5 -5
- package/docs/classes/index.DreamTransaction.html +2 -2
- package/docs/classes/index.Env.html +2 -2
- package/docs/classes/index.Query.html +53 -53
- package/docs/classes/system.CliFileWriter.html +2 -2
- package/docs/classes/system.DreamBin.html +2 -2
- package/docs/classes/system.DreamCLI.html +5 -5
- package/docs/classes/system.DreamImporter.html +2 -2
- package/docs/classes/system.DreamLogos.html +2 -2
- package/docs/classes/system.DreamSerializerBuilder.html +8 -8
- package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
- package/docs/classes/utils.Encrypt.html +2 -2
- package/docs/classes/utils.Range.html +2 -2
- package/docs/functions/db.closeAllDbConnections.html +1 -1
- package/docs/functions/db.dreamDbConnections.html +1 -1
- package/docs/functions/db.untypedDb.html +1 -1
- package/docs/functions/db.validateColumn.html +1 -1
- package/docs/functions/db.validateTable.html +1 -1
- package/docs/functions/errors.pgErrorType.html +1 -1
- package/docs/functions/index.DreamSerializer.html +1 -1
- package/docs/functions/index.ObjectSerializer.html +1 -1
- package/docs/functions/index.ReplicaSafe.html +1 -1
- package/docs/functions/index.STI.html +1 -1
- package/docs/functions/index.SoftDelete.html +1 -1
- package/docs/functions/utils.camelize.html +1 -1
- package/docs/functions/utils.capitalize.html +1 -1
- package/docs/functions/utils.cloneDeepSafe.html +1 -1
- package/docs/functions/utils.compact.html +1 -1
- package/docs/functions/utils.groupBy.html +1 -1
- package/docs/functions/utils.hyphenize.html +1 -1
- package/docs/functions/utils.intersection.html +1 -1
- package/docs/functions/utils.isEmpty.html +1 -1
- package/docs/functions/utils.normalizeUnicode.html +1 -1
- package/docs/functions/utils.pascalize.html +1 -1
- package/docs/functions/utils.percent.html +1 -1
- package/docs/functions/utils.range-1.html +1 -1
- package/docs/functions/utils.round.html +1 -1
- package/docs/functions/utils.sanitizeString.html +1 -1
- package/docs/functions/utils.snakeify.html +1 -1
- package/docs/functions/utils.sort.html +1 -1
- package/docs/functions/utils.sortBy.html +1 -1
- package/docs/functions/utils.sortObjectByKey.html +1 -1
- package/docs/functions/utils.sortObjectByValue.html +1 -1
- package/docs/functions/utils.uncapitalize.html +1 -1
- package/docs/functions/utils.uniq.html +1 -1
- package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
- package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
- package/docs/interfaces/types.BelongsToStatement.html +2 -2
- package/docs/interfaces/types.DecoratorContext.html +2 -2
- package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
- package/docs/interfaces/types.DreamAppOpts.html +2 -2
- package/docs/interfaces/types.EncryptOptions.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
- package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
- package/docs/modules/db.html +1 -1
- package/docs/modules/errors.html +1 -1
- package/docs/modules/index.html +1 -1
- package/docs/modules/openapi.html +1 -1
- package/docs/modules/system.html +1 -1
- package/docs/modules/types.html +1 -1
- package/docs/modules/utils.html +1 -1
- package/docs/types/index.DateTime.html +1 -1
- package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/openapi.OpenapiAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiFormats.html +1 -1
- package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaString.html +1 -1
- package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiTypeField.html +1 -1
- package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
- package/docs/types/types.Camelized.html +1 -1
- package/docs/types/types.DbConnectionType.html +1 -1
- package/docs/types/types.DbTypes.html +1 -1
- package/docs/types/types.DreamAssociationMetadata.html +1 -1
- package/docs/types/types.DreamAttributes.html +1 -1
- package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
- package/docs/types/types.DreamClassColumn.html +1 -1
- package/docs/types/types.DreamColumn.html +1 -1
- package/docs/types/types.DreamColumnNames.html +1 -1
- package/docs/types/types.DreamLogLevel.html +1 -1
- package/docs/types/types.DreamLogger.html +1 -1
- package/docs/types/types.DreamModelSerializerType.html +1 -1
- package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
- package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/types.DreamParamSafeAttributes.html +1 -1
- package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
- package/docs/types/types.DreamSerializable.html +1 -1
- package/docs/types/types.DreamSerializableArray.html +1 -1
- package/docs/types/types.DreamSerializerKey.html +1 -1
- package/docs/types/types.DreamSerializers.html +1 -1
- package/docs/types/types.DreamVirtualColumns.html +1 -1
- package/docs/types/types.EncryptAlgorithm.html +1 -1
- package/docs/types/types.HasManyStatement.html +1 -1
- package/docs/types/types.HasOneStatement.html +1 -1
- package/docs/types/types.Hyphenized.html +1 -1
- package/docs/types/types.Pascalized.html +1 -1
- package/docs/types/types.RoundingPrecision.html +1 -1
- package/docs/types/types.SerializerCasing.html +1 -1
- package/docs/types/types.SimpleObjectSerializerType.html +1 -1
- package/docs/types/types.Snakeified.html +1 -1
- package/docs/types/types.StrictInterface.html +1 -1
- package/docs/types/types.UpdateableAssociationProperties.html +1 -1
- package/docs/types/types.UpdateableProperties.html +1 -1
- package/docs/types/types.ValidationType.html +1 -1
- package/docs/types/types.ViewModel.html +1 -1
- package/docs/types/types.ViewModelClass.html +1 -1
- package/docs/types/types.WhereStatementForDream.html +1 -1
- package/docs/types/types.WhereStatementForDreamClass.html +1 -1
- package/docs/variables/index.DateTime-1.html +1 -1
- package/docs/variables/index.DreamConst.html +1 -1
- package/docs/variables/index.ops.html +1 -1
- package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
- package/docs/variables/types.TRIGRAM_OPERATORS.html +1 -1
- package/docs/variables/types.primaryKeyTypes.html +1 -1
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ export default class DreamCLI {
|
|
|
76
76
|
static provide(program, { initializeDreamApp, seedDb, }) {
|
|
77
77
|
program
|
|
78
78
|
.command('sync')
|
|
79
|
-
.description('
|
|
79
|
+
.description('Generates types from the current state of the database.')
|
|
80
80
|
.option('--schema-only')
|
|
81
81
|
.action(async (options = {}) => {
|
|
82
82
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true });
|
|
@@ -102,7 +102,7 @@ export default class DreamCLI {
|
|
|
102
102
|
program
|
|
103
103
|
.command('generate:migration')
|
|
104
104
|
.alias('g:migration')
|
|
105
|
-
.description('
|
|
105
|
+
.description('Generates a new migration file (prefer g:resource or g:model if creating a table for a new model).')
|
|
106
106
|
.argument('<migrationName>', 'end with -to-table-name or -from-table-name to prepopulate with an alterTable command')
|
|
107
107
|
.option('--connection-name <connectionName>', 'the connection name you wish to use for your migration')
|
|
108
108
|
.argument('[columnsWithTypes...]', columnsWithTypesDescriptionForMigration)
|
|
@@ -116,10 +116,10 @@ export default class DreamCLI {
|
|
|
116
116
|
.alias('g:model')
|
|
117
117
|
.alias('generate:dream')
|
|
118
118
|
.alias('g:dream')
|
|
119
|
+
.description('Generates a Dream model with corresponding spec factory, serializer, and migration.')
|
|
119
120
|
.option('--no-serializer')
|
|
120
121
|
.option('--connection-name <connectionName>', 'the db connection you want this attached to (defaults to the default db connection)', 'default')
|
|
121
122
|
.option('--sti-base-serializer')
|
|
122
|
-
.description('create a new Dream model')
|
|
123
123
|
.argument('<modelName>', 'the name of the model to create, e.g. Post or Settings/CommunicationPreferences')
|
|
124
124
|
.argument('[columnsWithTypes...]', columnsWithTypesDescription)
|
|
125
125
|
.action(async (modelName, columnsWithTypes, options) => {
|
|
@@ -130,7 +130,7 @@ export default class DreamCLI {
|
|
|
130
130
|
program
|
|
131
131
|
.command('generate:sti-child')
|
|
132
132
|
.alias('g:sti-child')
|
|
133
|
-
.description('
|
|
133
|
+
.description('Generates a Dream model that extends another Dream model, leveraging STI (single table inheritance), with corresponding spec factory, serializer, and migration.')
|
|
134
134
|
.option('--no-serializer')
|
|
135
135
|
.option('--connection-name', 'the db connection you want this model attached to (defaults to the default connection)', 'default')
|
|
136
136
|
.argument('<childModelName>', 'the name of the model to create, e.g. Post or Settings/CommunicationPreferences')
|
|
@@ -148,7 +148,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
148
148
|
});
|
|
149
149
|
program
|
|
150
150
|
.command('db:create')
|
|
151
|
-
.description('
|
|
151
|
+
.description('Creates a new database.')
|
|
152
152
|
.action(async () => {
|
|
153
153
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true, bypassDbConnectionsDuringInit: true });
|
|
154
154
|
await DreamBin.dbCreate();
|
|
@@ -156,7 +156,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
156
156
|
});
|
|
157
157
|
program
|
|
158
158
|
.command('db:integrity-check')
|
|
159
|
-
.description('
|
|
159
|
+
.description('Fails if migrations need to be run.')
|
|
160
160
|
.action(async () => {
|
|
161
161
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true });
|
|
162
162
|
await DreamBin.dbEnsureAllMigrationsHaveBeenRun();
|
|
@@ -164,7 +164,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
164
164
|
});
|
|
165
165
|
program
|
|
166
166
|
.command('db:migrate')
|
|
167
|
-
.description('
|
|
167
|
+
.description('Runs any outstanding database migrations.')
|
|
168
168
|
.option('--skip-sync', 'skips syncing local schema after running migrations')
|
|
169
169
|
.action(async ({ skipSync }) => {
|
|
170
170
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true });
|
|
@@ -176,7 +176,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
176
176
|
});
|
|
177
177
|
program
|
|
178
178
|
.command('db:rollback')
|
|
179
|
-
.description('
|
|
179
|
+
.description('Rolls back the specified number of migration steps (defaults to 1)')
|
|
180
180
|
.option('--steps <number>', 'number of steps back to travel', myParseInt, 1)
|
|
181
181
|
.option('--skip-sync', 'skips syncing local schema after running migrations')
|
|
182
182
|
.action(async ({ steps, skipSync }) => {
|
|
@@ -189,7 +189,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
189
189
|
});
|
|
190
190
|
program
|
|
191
191
|
.command('db:drop')
|
|
192
|
-
.description('
|
|
192
|
+
.description('Drops the database')
|
|
193
193
|
.action(async () => {
|
|
194
194
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true, bypassDbConnectionsDuringInit: true });
|
|
195
195
|
await DreamBin.dbDrop();
|
|
@@ -197,7 +197,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
197
197
|
});
|
|
198
198
|
program
|
|
199
199
|
.command('db:reset')
|
|
200
|
-
.description('
|
|
200
|
+
.description('Runs db:drop (safely), db:create, db:migrate, and db:seed')
|
|
201
201
|
.action(async () => {
|
|
202
202
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true, bypassDbConnectionsDuringInit: true });
|
|
203
203
|
await DreamBin.dbDrop();
|
|
@@ -210,7 +210,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
210
210
|
});
|
|
211
211
|
program
|
|
212
212
|
.command('db:seed')
|
|
213
|
-
.description('
|
|
213
|
+
.description('Seeds the database using the file located in db/seed.ts.')
|
|
214
214
|
.action(async () => {
|
|
215
215
|
if (process.env.NODE_ENV === 'test' && process.env.DREAM_SEED_DB_IN_TEST !== '1') {
|
|
216
216
|
console.log('skipping db seed for test env. To really seed for test, add DREAM_SEED_DB_IN_TEST=1');
|
|
@@ -223,7 +223,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
223
223
|
program
|
|
224
224
|
.command('inspect:serialization')
|
|
225
225
|
.alias('i:serialization')
|
|
226
|
-
.description('
|
|
226
|
+
.description('Displays a serialization map to help understand the rendering logic for a particular model.')
|
|
227
227
|
.argument('<globalName>', 'the global name of the model you want to look up')
|
|
228
228
|
.argument('[serializerKey]', 'the serializer key you wish to use')
|
|
229
229
|
.action(async (globalName, serializerKey) => {
|
|
@@ -76,7 +76,7 @@ export default class DreamCLI {
|
|
|
76
76
|
static provide(program, { initializeDreamApp, seedDb, }) {
|
|
77
77
|
program
|
|
78
78
|
.command('sync')
|
|
79
|
-
.description('
|
|
79
|
+
.description('Generates types from the current state of the database.')
|
|
80
80
|
.option('--schema-only')
|
|
81
81
|
.action(async (options = {}) => {
|
|
82
82
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true });
|
|
@@ -102,7 +102,7 @@ export default class DreamCLI {
|
|
|
102
102
|
program
|
|
103
103
|
.command('generate:migration')
|
|
104
104
|
.alias('g:migration')
|
|
105
|
-
.description('
|
|
105
|
+
.description('Generates a new migration file (prefer g:resource or g:model if creating a table for a new model).')
|
|
106
106
|
.argument('<migrationName>', 'end with -to-table-name or -from-table-name to prepopulate with an alterTable command')
|
|
107
107
|
.option('--connection-name <connectionName>', 'the connection name you wish to use for your migration')
|
|
108
108
|
.argument('[columnsWithTypes...]', columnsWithTypesDescriptionForMigration)
|
|
@@ -116,10 +116,10 @@ export default class DreamCLI {
|
|
|
116
116
|
.alias('g:model')
|
|
117
117
|
.alias('generate:dream')
|
|
118
118
|
.alias('g:dream')
|
|
119
|
+
.description('Generates a Dream model with corresponding spec factory, serializer, and migration.')
|
|
119
120
|
.option('--no-serializer')
|
|
120
121
|
.option('--connection-name <connectionName>', 'the db connection you want this attached to (defaults to the default db connection)', 'default')
|
|
121
122
|
.option('--sti-base-serializer')
|
|
122
|
-
.description('create a new Dream model')
|
|
123
123
|
.argument('<modelName>', 'the name of the model to create, e.g. Post or Settings/CommunicationPreferences')
|
|
124
124
|
.argument('[columnsWithTypes...]', columnsWithTypesDescription)
|
|
125
125
|
.action(async (modelName, columnsWithTypes, options) => {
|
|
@@ -130,7 +130,7 @@ export default class DreamCLI {
|
|
|
130
130
|
program
|
|
131
131
|
.command('generate:sti-child')
|
|
132
132
|
.alias('g:sti-child')
|
|
133
|
-
.description('
|
|
133
|
+
.description('Generates a Dream model that extends another Dream model, leveraging STI (single table inheritance), with corresponding spec factory, serializer, and migration.')
|
|
134
134
|
.option('--no-serializer')
|
|
135
135
|
.option('--connection-name', 'the db connection you want this model attached to (defaults to the default connection)', 'default')
|
|
136
136
|
.argument('<childModelName>', 'the name of the model to create, e.g. Post or Settings/CommunicationPreferences')
|
|
@@ -148,7 +148,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
148
148
|
});
|
|
149
149
|
program
|
|
150
150
|
.command('db:create')
|
|
151
|
-
.description('
|
|
151
|
+
.description('Creates a new database.')
|
|
152
152
|
.action(async () => {
|
|
153
153
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true, bypassDbConnectionsDuringInit: true });
|
|
154
154
|
await DreamBin.dbCreate();
|
|
@@ -156,7 +156,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
156
156
|
});
|
|
157
157
|
program
|
|
158
158
|
.command('db:integrity-check')
|
|
159
|
-
.description('
|
|
159
|
+
.description('Fails if migrations need to be run.')
|
|
160
160
|
.action(async () => {
|
|
161
161
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true });
|
|
162
162
|
await DreamBin.dbEnsureAllMigrationsHaveBeenRun();
|
|
@@ -164,7 +164,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
164
164
|
});
|
|
165
165
|
program
|
|
166
166
|
.command('db:migrate')
|
|
167
|
-
.description('
|
|
167
|
+
.description('Runs any outstanding database migrations.')
|
|
168
168
|
.option('--skip-sync', 'skips syncing local schema after running migrations')
|
|
169
169
|
.action(async ({ skipSync }) => {
|
|
170
170
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true });
|
|
@@ -176,7 +176,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
176
176
|
});
|
|
177
177
|
program
|
|
178
178
|
.command('db:rollback')
|
|
179
|
-
.description('
|
|
179
|
+
.description('Rolls back the specified number of migration steps (defaults to 1)')
|
|
180
180
|
.option('--steps <number>', 'number of steps back to travel', myParseInt, 1)
|
|
181
181
|
.option('--skip-sync', 'skips syncing local schema after running migrations')
|
|
182
182
|
.action(async ({ steps, skipSync }) => {
|
|
@@ -189,7 +189,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
189
189
|
});
|
|
190
190
|
program
|
|
191
191
|
.command('db:drop')
|
|
192
|
-
.description('
|
|
192
|
+
.description('Drops the database')
|
|
193
193
|
.action(async () => {
|
|
194
194
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true, bypassDbConnectionsDuringInit: true });
|
|
195
195
|
await DreamBin.dbDrop();
|
|
@@ -197,7 +197,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
197
197
|
});
|
|
198
198
|
program
|
|
199
199
|
.command('db:reset')
|
|
200
|
-
.description('
|
|
200
|
+
.description('Runs db:drop (safely), db:create, db:migrate, and db:seed')
|
|
201
201
|
.action(async () => {
|
|
202
202
|
await initializeDreamApp({ bypassDreamIntegrityChecks: true, bypassDbConnectionsDuringInit: true });
|
|
203
203
|
await DreamBin.dbDrop();
|
|
@@ -210,7 +210,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
210
210
|
});
|
|
211
211
|
program
|
|
212
212
|
.command('db:seed')
|
|
213
|
-
.description('
|
|
213
|
+
.description('Seeds the database using the file located in db/seed.ts.')
|
|
214
214
|
.action(async () => {
|
|
215
215
|
if (process.env.NODE_ENV === 'test' && process.env.DREAM_SEED_DB_IN_TEST !== '1') {
|
|
216
216
|
console.log('skipping db seed for test env. To really seed for test, add DREAM_SEED_DB_IN_TEST=1');
|
|
@@ -223,7 +223,7 @@ ${INDENT} to extend the Coach model in src/app/models/Health/Coach: Health/Co
|
|
|
223
223
|
program
|
|
224
224
|
.command('inspect:serialization')
|
|
225
225
|
.alias('i:serialization')
|
|
226
|
-
.description('
|
|
226
|
+
.description('Displays a serialization map to help understand the rendering logic for a particular model.')
|
|
227
227
|
.argument('<globalName>', 'the global name of the model you want to look up')
|
|
228
228
|
.argument('[serializerKey]', 'the serializer key you wish to use')
|
|
229
229
|
.action(async (globalName, serializerKey) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><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></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@rvoh/dream</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@rvoh/dream</a></li><li><a href="../modules/db.html">db</a></li><li><a href="db.DreamMigrationHelpers.html">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/
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><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></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@rvoh/dream</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@rvoh/dream</a></li><li><a href="../modules/db.html">db</a></li><li><a href="db.DreamMigrationHelpers.html">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/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L3">src/db/migration-helpers/DreamMigrationHelpers.ts:3</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"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> 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="db.DreamMigrationHelpers.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><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="db.DreamMigrationHelpers.html#addDeferrableUniqueConstraint" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Deferrable<wbr/>Unique<wbr/>Constraint</span></a>
|
|
3
3
|
<a href="db.DreamMigrationHelpers.html#addEnumValue" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Enum<wbr/>Value</span></a>
|
|
4
4
|
<a href="db.DreamMigrationHelpers.html#createExtension" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Extension</span></a>
|
|
@@ -16,11 +16,11 @@ indexes.</p>
|
|
|
16
16
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </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><br/><span> </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><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
|
|
17
17
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
18
18
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
19
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
19
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L41">src/db/migration-helpers/DreamMigrationHelpers.ts:41</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="addEnumValue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="addEnumValue.addEnumValue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Enum<wbr/>Value</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span>, <span class="tsd-kind-parameter">__namedParameters</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#addEnumValue.addEnumValue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Add a value to an enum.</p>
|
|
20
20
|
<p>Note that this always includes "IF NOT EXISTS", so is safe to re-run multiple times.</p>
|
|
21
21
|
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
|
|
22
22
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
23
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
23
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L71">src/db/migration-helpers/DreamMigrationHelpers.ts:71</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="createExtension" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="createExtension.createExtension-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">create<wbr/>Extension</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span>, <span class="tsd-kind-parameter">extensionName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#createExtension.createExtension-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a database extension.</p>
|
|
24
24
|
<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">'citext'</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">'pg_trgm'</span><span class="hl-1">)</span>
|
|
25
25
|
</code><button>Copy</button></pre>
|
|
26
26
|
|
|
@@ -29,23 +29,23 @@ indexes.</p>
|
|
|
29
29
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </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><br/><span> </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><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
|
|
30
30
|
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">if<wbr/>Not<wbr/>Exists</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>
|
|
31
31
|
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">public<wbr/>Schema</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>
|
|
32
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
32
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L93">src/db/migration-helpers/DreamMigrationHelpers.ts:93</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="createGinIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="createGinIndex.createGinIndex-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">create<wbr/>Gin<wbr/>Index</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span>, <span class="tsd-kind-parameter">indexName</span>, <span class="tsd-kind-parameter">options</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#createGinIndex.createGinIndex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a gin index</p>
|
|
33
33
|
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
|
|
34
34
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
35
35
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </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><br/><span> </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><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
|
|
36
36
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
37
37
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
38
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
38
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L115">src/db/migration-helpers/DreamMigrationHelpers.ts:115</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dropConstraint" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dropConstraint.dropConstraint-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop<wbr/>Constraint</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span>, <span class="tsd-kind-parameter">constraintName</span>, <span class="tsd-kind-parameter">options</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#dropConstraint.dropConstraint-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop a constraint</p>
|
|
39
39
|
<p>Note that this always includes "IF NOT EXISTS", so is safe to re-run multiple times.</p>
|
|
40
40
|
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
|
|
41
41
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
42
42
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-symbol">{ </span><br/><span> </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><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options</p>
|
|
43
43
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
44
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
44
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L138">src/db/migration-helpers/DreamMigrationHelpers.ts:138</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dropEnumValue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dropEnumValue.dropEnumValue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop<wbr/>Enum<wbr/>Value</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span>, <span class="tsd-kind-parameter">__namedParameters</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#dropEnumValue.dropEnumValue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop a value from an enum and replace it with a different enum already
|
|
45
45
|
present in the enum type (or optionally remove it from array columns).</p>
|
|
46
46
|
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
|
|
47
47
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
48
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
48
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L191">src/db/migration-helpers/DreamMigrationHelpers.ts:191</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="newTransaction" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="newTransaction.newTransaction-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">new<wbr/>Transaction</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#newTransaction.newTransaction-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Forces a new transaction boundary in migration execution.</p>
|
|
49
49
|
<p>When called in a migration file, this method ensures that any existing transaction
|
|
50
50
|
is committed before this migration runs, and a new transaction is started before the
|
|
51
51
|
migration in this file. This is essential for migrations that depend on previously
|
|
@@ -56,7 +56,7 @@ enum values to be committed to the database first.</p>
|
|
|
56
56
|
<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"><</span><span class="hl-9">any</span><span class="hl-1">>): </span><span class="hl-9">Promise</span><span class="hl-1"><</span><span class="hl-9">void</span><span class="hl-1">> {</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">'user_status'</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">'premium'</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"><</span><span class="hl-9">any</span><span class="hl-1">>): </span><span class="hl-9">Promise</span><span class="hl-1"><</span><span class="hl-9">void</span><span class="hl-1">> {</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">'users'</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">'check_premium_users'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">sql</span><span class="hl-6">`status = 'premium' OR credits < 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>
|
|
57
57
|
</code><button type="button">Copy</button></pre>
|
|
58
58
|
|
|
59
|
-
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
59
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L179">src/db/migration-helpers/DreamMigrationHelpers.ts:179</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="renameTable" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><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"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="renameTable.renameTable-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">rename<wbr/>Table</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">db</span>, <span class="tsd-kind-parameter">from</span>, <span class="tsd-kind-parameter">to</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"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#renameTable.renameTable-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Rename a table and its associated primary key sequence.</p>
|
|
60
60
|
<p>This method renames both the table and its primary key sequence to keep them
|
|
61
61
|
in sync. When PostgreSQL creates a table with a serial or bigserial primary key,
|
|
62
62
|
it automatically creates a sequence named <code>{tablename}_id_seq</code>. If you only rename
|
|
@@ -66,4 +66,4 @@ key column named 'id'.</p>
|
|
|
66
66
|
</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"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Kysely database object passed into the migration up/down function</p>
|
|
67
67
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
68
68
|
</div><div class="tsd-comment tsd-typography"></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>
|
|
69
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/
|
|
69
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/rvohealth/dream/blob/238f6be8bd2e7d991e598bee04c024c256d9e452/src/db/migration-helpers/DreamMigrationHelpers.ts#L19">src/db/migration-helpers/DreamMigrationHelpers.ts:19</a></li></ul></aside></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"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>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"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>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="tsd-otp-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><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="tsd-otp-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#addDeferrableUniqueConstraint" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Deferrable<wbr/>Unique<wbr/>Constraint</span></a><a href="#addEnumValue" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Enum<wbr/>Value</span></a><a href="#createExtension" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Extension</span></a><a href="#createGinIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Gin<wbr/>Index</span></a><a href="#dropConstraint" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Constraint</span></a><a href="#dropEnumValue" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Enum<wbr/>Value</span></a><a href="#newTransaction" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>new<wbr/>Transaction</span></a><a href="#renameTable" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><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="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@rvoh/dream</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><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>
|