arkormx 2.0.0-next.2 → 2.0.0-next.3
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/cli.mjs +164 -28
- package/dist/index.cjs +398 -29
- package/dist/index.d.cts +148 -96
- package/dist/index.d.mts +148 -96
- package/dist/index.mjs +387 -29
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,101 @@ import { PrismaClient } from "@prisma/client";
|
|
|
3
3
|
import { Collection } from "@h3ravel/collect.js";
|
|
4
4
|
import { Command } from "@h3ravel/musket";
|
|
5
5
|
|
|
6
|
+
//#region src/types/migrations.d.ts
|
|
7
|
+
type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
|
|
8
|
+
interface SchemaColumn {
|
|
9
|
+
name: string;
|
|
10
|
+
type: SchemaColumnType;
|
|
11
|
+
enumName?: string;
|
|
12
|
+
enumValues?: string[];
|
|
13
|
+
map?: string;
|
|
14
|
+
nullable?: boolean;
|
|
15
|
+
unique?: boolean;
|
|
16
|
+
primary?: boolean;
|
|
17
|
+
autoIncrement?: boolean;
|
|
18
|
+
after?: string;
|
|
19
|
+
default?: unknown;
|
|
20
|
+
updatedAt?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface SchemaIndex {
|
|
23
|
+
columns: string[];
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
26
|
+
type SchemaForeignKeyAction = 'cascade' | 'restrict' | 'setNull' | 'noAction' | 'setDefault';
|
|
27
|
+
interface SchemaForeignKey {
|
|
28
|
+
column: string;
|
|
29
|
+
referencesTable: string;
|
|
30
|
+
referencesColumn: string;
|
|
31
|
+
onDelete?: SchemaForeignKeyAction;
|
|
32
|
+
relationAlias?: string;
|
|
33
|
+
inverseRelationAlias?: string;
|
|
34
|
+
fieldAlias?: string;
|
|
35
|
+
}
|
|
36
|
+
interface SchemaTableCreateOperation {
|
|
37
|
+
type: 'createTable';
|
|
38
|
+
table: string;
|
|
39
|
+
columns: SchemaColumn[];
|
|
40
|
+
indexes: SchemaIndex[];
|
|
41
|
+
foreignKeys: SchemaForeignKey[];
|
|
42
|
+
}
|
|
43
|
+
interface SchemaTableAlterOperation {
|
|
44
|
+
type: 'alterTable';
|
|
45
|
+
table: string;
|
|
46
|
+
addColumns: SchemaColumn[];
|
|
47
|
+
dropColumns: string[];
|
|
48
|
+
addIndexes: SchemaIndex[];
|
|
49
|
+
addForeignKeys: SchemaForeignKey[];
|
|
50
|
+
}
|
|
51
|
+
interface SchemaTableDropOperation {
|
|
52
|
+
type: 'dropTable';
|
|
53
|
+
table: string;
|
|
54
|
+
}
|
|
55
|
+
type SchemaOperation = SchemaTableCreateOperation | SchemaTableAlterOperation | SchemaTableDropOperation;
|
|
56
|
+
interface GenerateMigrationOptions {
|
|
57
|
+
directory?: string;
|
|
58
|
+
extension?: 'ts' | 'js';
|
|
59
|
+
write?: boolean;
|
|
60
|
+
}
|
|
61
|
+
interface GeneratedMigrationFile {
|
|
62
|
+
fileName: string;
|
|
63
|
+
filePath: string;
|
|
64
|
+
className: string;
|
|
65
|
+
content: string;
|
|
66
|
+
}
|
|
67
|
+
interface PrismaSchemaSyncOptions {
|
|
68
|
+
schemaPath?: string;
|
|
69
|
+
write?: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
|
|
72
|
+
cwd?: string;
|
|
73
|
+
runGenerate?: boolean;
|
|
74
|
+
runMigrate?: boolean;
|
|
75
|
+
migrateMode?: 'dev' | 'deploy';
|
|
76
|
+
migrationName?: string;
|
|
77
|
+
}
|
|
78
|
+
type MigrationInstanceLike = {
|
|
79
|
+
up: (...args: any[]) => Promise<void> | void;
|
|
80
|
+
down: (...args: any[]) => Promise<void> | void;
|
|
81
|
+
};
|
|
82
|
+
interface AppliedMigrationEntry {
|
|
83
|
+
id: string;
|
|
84
|
+
file: string;
|
|
85
|
+
className: string;
|
|
86
|
+
appliedAt: string;
|
|
87
|
+
checksum?: string;
|
|
88
|
+
}
|
|
89
|
+
interface AppliedMigrationRun {
|
|
90
|
+
id: string;
|
|
91
|
+
appliedAt: string;
|
|
92
|
+
migrationIds: string[];
|
|
93
|
+
}
|
|
94
|
+
interface AppliedMigrationsState {
|
|
95
|
+
version: 1;
|
|
96
|
+
migrations: AppliedMigrationEntry[];
|
|
97
|
+
runs?: AppliedMigrationRun[];
|
|
98
|
+
}
|
|
99
|
+
type MigrationClass = new () => MigrationInstanceLike;
|
|
100
|
+
//#endregion
|
|
6
101
|
//#region src/types/core.d.ts
|
|
7
102
|
type CastType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'array';
|
|
8
103
|
interface CastHandler<T = unknown> {
|
|
@@ -294,101 +389,6 @@ interface FactoryModelConstructor<TModel> {
|
|
|
294
389
|
type FactoryDefinition<TAttributes extends FactoryAttributes> = (sequence: number) => TAttributes;
|
|
295
390
|
type FactoryState<TAttributes extends FactoryAttributes> = (attributes: TAttributes, sequence: number) => TAttributes;
|
|
296
391
|
//#endregion
|
|
297
|
-
//#region src/types/migrations.d.ts
|
|
298
|
-
type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
|
|
299
|
-
interface SchemaColumn {
|
|
300
|
-
name: string;
|
|
301
|
-
type: SchemaColumnType;
|
|
302
|
-
enumName?: string;
|
|
303
|
-
enumValues?: string[];
|
|
304
|
-
map?: string;
|
|
305
|
-
nullable?: boolean;
|
|
306
|
-
unique?: boolean;
|
|
307
|
-
primary?: boolean;
|
|
308
|
-
autoIncrement?: boolean;
|
|
309
|
-
after?: string;
|
|
310
|
-
default?: unknown;
|
|
311
|
-
updatedAt?: boolean;
|
|
312
|
-
}
|
|
313
|
-
interface SchemaIndex {
|
|
314
|
-
columns: string[];
|
|
315
|
-
name?: string;
|
|
316
|
-
}
|
|
317
|
-
type SchemaForeignKeyAction = 'cascade' | 'restrict' | 'setNull' | 'noAction' | 'setDefault';
|
|
318
|
-
interface SchemaForeignKey {
|
|
319
|
-
column: string;
|
|
320
|
-
referencesTable: string;
|
|
321
|
-
referencesColumn: string;
|
|
322
|
-
onDelete?: SchemaForeignKeyAction;
|
|
323
|
-
relationAlias?: string;
|
|
324
|
-
inverseRelationAlias?: string;
|
|
325
|
-
fieldAlias?: string;
|
|
326
|
-
}
|
|
327
|
-
interface SchemaTableCreateOperation {
|
|
328
|
-
type: 'createTable';
|
|
329
|
-
table: string;
|
|
330
|
-
columns: SchemaColumn[];
|
|
331
|
-
indexes: SchemaIndex[];
|
|
332
|
-
foreignKeys: SchemaForeignKey[];
|
|
333
|
-
}
|
|
334
|
-
interface SchemaTableAlterOperation {
|
|
335
|
-
type: 'alterTable';
|
|
336
|
-
table: string;
|
|
337
|
-
addColumns: SchemaColumn[];
|
|
338
|
-
dropColumns: string[];
|
|
339
|
-
addIndexes: SchemaIndex[];
|
|
340
|
-
addForeignKeys: SchemaForeignKey[];
|
|
341
|
-
}
|
|
342
|
-
interface SchemaTableDropOperation {
|
|
343
|
-
type: 'dropTable';
|
|
344
|
-
table: string;
|
|
345
|
-
}
|
|
346
|
-
type SchemaOperation = SchemaTableCreateOperation | SchemaTableAlterOperation | SchemaTableDropOperation;
|
|
347
|
-
interface GenerateMigrationOptions {
|
|
348
|
-
directory?: string;
|
|
349
|
-
extension?: 'ts' | 'js';
|
|
350
|
-
write?: boolean;
|
|
351
|
-
}
|
|
352
|
-
interface GeneratedMigrationFile {
|
|
353
|
-
fileName: string;
|
|
354
|
-
filePath: string;
|
|
355
|
-
className: string;
|
|
356
|
-
content: string;
|
|
357
|
-
}
|
|
358
|
-
interface PrismaSchemaSyncOptions {
|
|
359
|
-
schemaPath?: string;
|
|
360
|
-
write?: boolean;
|
|
361
|
-
}
|
|
362
|
-
interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
|
|
363
|
-
cwd?: string;
|
|
364
|
-
runGenerate?: boolean;
|
|
365
|
-
runMigrate?: boolean;
|
|
366
|
-
migrateMode?: 'dev' | 'deploy';
|
|
367
|
-
migrationName?: string;
|
|
368
|
-
}
|
|
369
|
-
type MigrationInstanceLike = {
|
|
370
|
-
up: (...args: any[]) => Promise<void> | void;
|
|
371
|
-
down: (...args: any[]) => Promise<void> | void;
|
|
372
|
-
};
|
|
373
|
-
interface AppliedMigrationEntry {
|
|
374
|
-
id: string;
|
|
375
|
-
file: string;
|
|
376
|
-
className: string;
|
|
377
|
-
appliedAt: string;
|
|
378
|
-
checksum?: string;
|
|
379
|
-
}
|
|
380
|
-
interface AppliedMigrationRun {
|
|
381
|
-
id: string;
|
|
382
|
-
appliedAt: string;
|
|
383
|
-
migrationIds: string[];
|
|
384
|
-
}
|
|
385
|
-
interface AppliedMigrationsState {
|
|
386
|
-
version: 1;
|
|
387
|
-
migrations: AppliedMigrationEntry[];
|
|
388
|
-
runs?: AppliedMigrationRun[];
|
|
389
|
-
}
|
|
390
|
-
type MigrationClass = new () => MigrationInstanceLike;
|
|
391
|
-
//#endregion
|
|
392
392
|
//#region src/Collection.d.ts
|
|
393
393
|
declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
|
|
394
394
|
//#endregion
|
|
@@ -2771,6 +2771,10 @@ interface DatabaseAdapter {
|
|
|
2771
2771
|
exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
|
|
2772
2772
|
loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
|
|
2773
2773
|
introspectModels?: (options?: AdapterModelIntrospectionOptions) => Promise<AdapterModelStructure[]>;
|
|
2774
|
+
executeSchemaOperations?: (operations: SchemaOperation[]) => Promise<void>;
|
|
2775
|
+
resetDatabase?: () => Promise<void>;
|
|
2776
|
+
readAppliedMigrationsState?: () => Promise<AppliedMigrationsState>;
|
|
2777
|
+
writeAppliedMigrationsState?: (state: AppliedMigrationsState) => Promise<void>;
|
|
2774
2778
|
transaction: <TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext) => Promise<TResult>;
|
|
2775
2779
|
}
|
|
2776
2780
|
//#endregion
|
|
@@ -2787,8 +2791,29 @@ type KyselyTableMapping = Record<string, string>;
|
|
|
2787
2791
|
declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
2788
2792
|
private readonly db;
|
|
2789
2793
|
private readonly mapping;
|
|
2794
|
+
private static readonly migrationStateTable;
|
|
2795
|
+
private static readonly migrationRunTable;
|
|
2790
2796
|
readonly capabilities: AdapterCapabilities;
|
|
2791
2797
|
constructor(db: KyselyExecutor, mapping?: KyselyTableMapping);
|
|
2798
|
+
private quoteIdentifier;
|
|
2799
|
+
private quoteLiteral;
|
|
2800
|
+
private executeRawStatement;
|
|
2801
|
+
private resolveSchemaColumnName;
|
|
2802
|
+
private resolveSchemaIndexName;
|
|
2803
|
+
private resolveSchemaForeignKeyName;
|
|
2804
|
+
private resolveSchemaColumnType;
|
|
2805
|
+
private resolveSchemaColumnDefault;
|
|
2806
|
+
private shouldUseIdentity;
|
|
2807
|
+
private buildSchemaColumnDefinition;
|
|
2808
|
+
private buildSchemaForeignKeyConstraint;
|
|
2809
|
+
private buildSchemaIndexStatement;
|
|
2810
|
+
private ensureEnumTypes;
|
|
2811
|
+
private executeCreateTableOperation;
|
|
2812
|
+
private executeAlterTableOperation;
|
|
2813
|
+
private executeDropTableOperation;
|
|
2814
|
+
private ensureMigrationStateTables;
|
|
2815
|
+
private writeAppliedMigrationsStateInternal;
|
|
2816
|
+
private resetDatabaseInternal;
|
|
2792
2817
|
private introspectionTypeToTs;
|
|
2793
2818
|
private resolveTable;
|
|
2794
2819
|
private resolvePrimaryKey;
|
|
@@ -2914,6 +2939,10 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
2914
2939
|
*/
|
|
2915
2940
|
exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
|
|
2916
2941
|
introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
|
|
2942
|
+
executeSchemaOperations(operations: SchemaOperation[]): Promise<void>;
|
|
2943
|
+
resetDatabase(): Promise<void>;
|
|
2944
|
+
readAppliedMigrationsState(): Promise<AppliedMigrationsState>;
|
|
2945
|
+
writeAppliedMigrationsState(state: AppliedMigrationsState): Promise<void>;
|
|
2917
2946
|
/**
|
|
2918
2947
|
* Executes a series of database operations within a transaction.
|
|
2919
2948
|
* The provided callback function is called with a new instance of the
|
|
@@ -3473,6 +3502,15 @@ declare class MigrateCommand extends Command<CliApp> {
|
|
|
3473
3502
|
private loadMigrationClassesFromFile;
|
|
3474
3503
|
}
|
|
3475
3504
|
//#endregion
|
|
3505
|
+
//#region src/cli/commands/MigrateFreshCommand.d.ts
|
|
3506
|
+
declare class MigrateFreshCommand extends Command<CliApp> {
|
|
3507
|
+
protected signature: string;
|
|
3508
|
+
protected description: string;
|
|
3509
|
+
handle(): Promise<undefined>;
|
|
3510
|
+
private loadAllMigrations;
|
|
3511
|
+
private loadMigrationClassesFromFile;
|
|
3512
|
+
}
|
|
3513
|
+
//#endregion
|
|
3476
3514
|
//#region src/cli/commands/MigrateRollbackCommand.d.ts
|
|
3477
3515
|
/**
|
|
3478
3516
|
* Rollback migration classes from the Prisma schema and run Prisma workflow.
|
|
@@ -4113,11 +4151,16 @@ declare class UnsupportedAdapterFeatureException extends ArkormException {
|
|
|
4113
4151
|
}
|
|
4114
4152
|
//#endregion
|
|
4115
4153
|
//#region src/helpers/migration-history.d.ts
|
|
4154
|
+
declare const createEmptyAppliedMigrationsState: () => AppliedMigrationsState;
|
|
4155
|
+
declare const supportsDatabaseMigrationState: (adapter?: DatabaseAdapter) => adapter is DatabaseAdapter & Required<Pick<DatabaseAdapter, "readAppliedMigrationsState" | "writeAppliedMigrationsState">>;
|
|
4116
4156
|
declare const resolveMigrationStateFilePath: (cwd: string, configuredPath?: string) => string;
|
|
4117
4157
|
declare const buildMigrationIdentity: (filePath: string, className: string) => string;
|
|
4118
4158
|
declare const computeMigrationChecksum: (filePath: string) => string;
|
|
4119
4159
|
declare const readAppliedMigrationsState: (stateFilePath: string) => AppliedMigrationsState;
|
|
4160
|
+
declare const readAppliedMigrationsStateFromStore: (adapter: DatabaseAdapter | undefined, stateFilePath: string) => Promise<AppliedMigrationsState>;
|
|
4120
4161
|
declare const writeAppliedMigrationsState: (stateFilePath: string, state: AppliedMigrationsState) => void;
|
|
4162
|
+
declare const writeAppliedMigrationsStateToStore: (adapter: DatabaseAdapter | undefined, stateFilePath: string, state: AppliedMigrationsState) => Promise<void>;
|
|
4163
|
+
declare const deleteAppliedMigrationsStateFromStore: (adapter: DatabaseAdapter | undefined, stateFilePath: string) => Promise<"database" | "file" | "missing-file">;
|
|
4121
4164
|
declare const isMigrationApplied: (state: AppliedMigrationsState, identity: string, checksum?: string) => boolean;
|
|
4122
4165
|
declare const findAppliedMigration: (state: AppliedMigrationsState, identity: string) => AppliedMigrationEntry | undefined;
|
|
4123
4166
|
declare const markMigrationApplied: (state: AppliedMigrationsState, entry: AppliedMigrationEntry) => AppliedMigrationsState;
|
|
@@ -4372,6 +4415,15 @@ declare const generateMigrationFile: (name: string, options?: GenerateMigrationO
|
|
|
4372
4415
|
* @returns A promise that resolves to an array of schema operations that would be performed.
|
|
4373
4416
|
*/
|
|
4374
4417
|
declare const getMigrationPlan: (migration: Migration | (new () => Migration), direction?: "up" | "down") => Promise<SchemaOperation[]>;
|
|
4418
|
+
declare const supportsDatabaseMigrationExecution: (adapter?: DatabaseAdapter) => adapter is DatabaseAdapter & Required<Pick<DatabaseAdapter, "executeSchemaOperations">>;
|
|
4419
|
+
declare const supportsDatabaseReset: (adapter?: DatabaseAdapter) => adapter is DatabaseAdapter & Required<Pick<DatabaseAdapter, "resetDatabase">>;
|
|
4420
|
+
declare const stripPrismaSchemaModelsAndEnums: (schema: string) => string;
|
|
4421
|
+
declare const applyMigrationToDatabase: (adapter: DatabaseAdapter, migration: Migration | (new () => Migration)) => Promise<{
|
|
4422
|
+
operations: SchemaOperation[];
|
|
4423
|
+
}>;
|
|
4424
|
+
declare const applyMigrationRollbackToDatabase: (adapter: DatabaseAdapter, migration: Migration | (new () => Migration)) => Promise<{
|
|
4425
|
+
operations: SchemaOperation[];
|
|
4426
|
+
}>;
|
|
4375
4427
|
/**
|
|
4376
4428
|
* Apply the schema operations defined in a migration to a Prisma schema
|
|
4377
4429
|
* file, updating the file on disk if specified, and return the updated
|
|
@@ -4543,4 +4595,4 @@ declare class URLDriver {
|
|
|
4543
4595
|
url(page: number): string;
|
|
4544
4596
|
}
|
|
4545
4597
|
//#endregion
|
|
4546
|
-
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
|
4598
|
+
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, toMigrationFileSlug, toModelName, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,101 @@ import { Command } from "@h3ravel/musket";
|
|
|
3
3
|
import { Collection } from "@h3ravel/collect.js";
|
|
4
4
|
import { PrismaClient } from "@prisma/client";
|
|
5
5
|
|
|
6
|
+
//#region src/types/migrations.d.ts
|
|
7
|
+
type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
|
|
8
|
+
interface SchemaColumn {
|
|
9
|
+
name: string;
|
|
10
|
+
type: SchemaColumnType;
|
|
11
|
+
enumName?: string;
|
|
12
|
+
enumValues?: string[];
|
|
13
|
+
map?: string;
|
|
14
|
+
nullable?: boolean;
|
|
15
|
+
unique?: boolean;
|
|
16
|
+
primary?: boolean;
|
|
17
|
+
autoIncrement?: boolean;
|
|
18
|
+
after?: string;
|
|
19
|
+
default?: unknown;
|
|
20
|
+
updatedAt?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface SchemaIndex {
|
|
23
|
+
columns: string[];
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
26
|
+
type SchemaForeignKeyAction = 'cascade' | 'restrict' | 'setNull' | 'noAction' | 'setDefault';
|
|
27
|
+
interface SchemaForeignKey {
|
|
28
|
+
column: string;
|
|
29
|
+
referencesTable: string;
|
|
30
|
+
referencesColumn: string;
|
|
31
|
+
onDelete?: SchemaForeignKeyAction;
|
|
32
|
+
relationAlias?: string;
|
|
33
|
+
inverseRelationAlias?: string;
|
|
34
|
+
fieldAlias?: string;
|
|
35
|
+
}
|
|
36
|
+
interface SchemaTableCreateOperation {
|
|
37
|
+
type: 'createTable';
|
|
38
|
+
table: string;
|
|
39
|
+
columns: SchemaColumn[];
|
|
40
|
+
indexes: SchemaIndex[];
|
|
41
|
+
foreignKeys: SchemaForeignKey[];
|
|
42
|
+
}
|
|
43
|
+
interface SchemaTableAlterOperation {
|
|
44
|
+
type: 'alterTable';
|
|
45
|
+
table: string;
|
|
46
|
+
addColumns: SchemaColumn[];
|
|
47
|
+
dropColumns: string[];
|
|
48
|
+
addIndexes: SchemaIndex[];
|
|
49
|
+
addForeignKeys: SchemaForeignKey[];
|
|
50
|
+
}
|
|
51
|
+
interface SchemaTableDropOperation {
|
|
52
|
+
type: 'dropTable';
|
|
53
|
+
table: string;
|
|
54
|
+
}
|
|
55
|
+
type SchemaOperation = SchemaTableCreateOperation | SchemaTableAlterOperation | SchemaTableDropOperation;
|
|
56
|
+
interface GenerateMigrationOptions {
|
|
57
|
+
directory?: string;
|
|
58
|
+
extension?: 'ts' | 'js';
|
|
59
|
+
write?: boolean;
|
|
60
|
+
}
|
|
61
|
+
interface GeneratedMigrationFile {
|
|
62
|
+
fileName: string;
|
|
63
|
+
filePath: string;
|
|
64
|
+
className: string;
|
|
65
|
+
content: string;
|
|
66
|
+
}
|
|
67
|
+
interface PrismaSchemaSyncOptions {
|
|
68
|
+
schemaPath?: string;
|
|
69
|
+
write?: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
|
|
72
|
+
cwd?: string;
|
|
73
|
+
runGenerate?: boolean;
|
|
74
|
+
runMigrate?: boolean;
|
|
75
|
+
migrateMode?: 'dev' | 'deploy';
|
|
76
|
+
migrationName?: string;
|
|
77
|
+
}
|
|
78
|
+
type MigrationInstanceLike = {
|
|
79
|
+
up: (...args: any[]) => Promise<void> | void;
|
|
80
|
+
down: (...args: any[]) => Promise<void> | void;
|
|
81
|
+
};
|
|
82
|
+
interface AppliedMigrationEntry {
|
|
83
|
+
id: string;
|
|
84
|
+
file: string;
|
|
85
|
+
className: string;
|
|
86
|
+
appliedAt: string;
|
|
87
|
+
checksum?: string;
|
|
88
|
+
}
|
|
89
|
+
interface AppliedMigrationRun {
|
|
90
|
+
id: string;
|
|
91
|
+
appliedAt: string;
|
|
92
|
+
migrationIds: string[];
|
|
93
|
+
}
|
|
94
|
+
interface AppliedMigrationsState {
|
|
95
|
+
version: 1;
|
|
96
|
+
migrations: AppliedMigrationEntry[];
|
|
97
|
+
runs?: AppliedMigrationRun[];
|
|
98
|
+
}
|
|
99
|
+
type MigrationClass = new () => MigrationInstanceLike;
|
|
100
|
+
//#endregion
|
|
6
101
|
//#region src/types/core.d.ts
|
|
7
102
|
type CastType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'array';
|
|
8
103
|
interface CastHandler<T = unknown> {
|
|
@@ -294,101 +389,6 @@ interface FactoryModelConstructor<TModel> {
|
|
|
294
389
|
type FactoryDefinition<TAttributes extends FactoryAttributes> = (sequence: number) => TAttributes;
|
|
295
390
|
type FactoryState<TAttributes extends FactoryAttributes> = (attributes: TAttributes, sequence: number) => TAttributes;
|
|
296
391
|
//#endregion
|
|
297
|
-
//#region src/types/migrations.d.ts
|
|
298
|
-
type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
|
|
299
|
-
interface SchemaColumn {
|
|
300
|
-
name: string;
|
|
301
|
-
type: SchemaColumnType;
|
|
302
|
-
enumName?: string;
|
|
303
|
-
enumValues?: string[];
|
|
304
|
-
map?: string;
|
|
305
|
-
nullable?: boolean;
|
|
306
|
-
unique?: boolean;
|
|
307
|
-
primary?: boolean;
|
|
308
|
-
autoIncrement?: boolean;
|
|
309
|
-
after?: string;
|
|
310
|
-
default?: unknown;
|
|
311
|
-
updatedAt?: boolean;
|
|
312
|
-
}
|
|
313
|
-
interface SchemaIndex {
|
|
314
|
-
columns: string[];
|
|
315
|
-
name?: string;
|
|
316
|
-
}
|
|
317
|
-
type SchemaForeignKeyAction = 'cascade' | 'restrict' | 'setNull' | 'noAction' | 'setDefault';
|
|
318
|
-
interface SchemaForeignKey {
|
|
319
|
-
column: string;
|
|
320
|
-
referencesTable: string;
|
|
321
|
-
referencesColumn: string;
|
|
322
|
-
onDelete?: SchemaForeignKeyAction;
|
|
323
|
-
relationAlias?: string;
|
|
324
|
-
inverseRelationAlias?: string;
|
|
325
|
-
fieldAlias?: string;
|
|
326
|
-
}
|
|
327
|
-
interface SchemaTableCreateOperation {
|
|
328
|
-
type: 'createTable';
|
|
329
|
-
table: string;
|
|
330
|
-
columns: SchemaColumn[];
|
|
331
|
-
indexes: SchemaIndex[];
|
|
332
|
-
foreignKeys: SchemaForeignKey[];
|
|
333
|
-
}
|
|
334
|
-
interface SchemaTableAlterOperation {
|
|
335
|
-
type: 'alterTable';
|
|
336
|
-
table: string;
|
|
337
|
-
addColumns: SchemaColumn[];
|
|
338
|
-
dropColumns: string[];
|
|
339
|
-
addIndexes: SchemaIndex[];
|
|
340
|
-
addForeignKeys: SchemaForeignKey[];
|
|
341
|
-
}
|
|
342
|
-
interface SchemaTableDropOperation {
|
|
343
|
-
type: 'dropTable';
|
|
344
|
-
table: string;
|
|
345
|
-
}
|
|
346
|
-
type SchemaOperation = SchemaTableCreateOperation | SchemaTableAlterOperation | SchemaTableDropOperation;
|
|
347
|
-
interface GenerateMigrationOptions {
|
|
348
|
-
directory?: string;
|
|
349
|
-
extension?: 'ts' | 'js';
|
|
350
|
-
write?: boolean;
|
|
351
|
-
}
|
|
352
|
-
interface GeneratedMigrationFile {
|
|
353
|
-
fileName: string;
|
|
354
|
-
filePath: string;
|
|
355
|
-
className: string;
|
|
356
|
-
content: string;
|
|
357
|
-
}
|
|
358
|
-
interface PrismaSchemaSyncOptions {
|
|
359
|
-
schemaPath?: string;
|
|
360
|
-
write?: boolean;
|
|
361
|
-
}
|
|
362
|
-
interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
|
|
363
|
-
cwd?: string;
|
|
364
|
-
runGenerate?: boolean;
|
|
365
|
-
runMigrate?: boolean;
|
|
366
|
-
migrateMode?: 'dev' | 'deploy';
|
|
367
|
-
migrationName?: string;
|
|
368
|
-
}
|
|
369
|
-
type MigrationInstanceLike = {
|
|
370
|
-
up: (...args: any[]) => Promise<void> | void;
|
|
371
|
-
down: (...args: any[]) => Promise<void> | void;
|
|
372
|
-
};
|
|
373
|
-
interface AppliedMigrationEntry {
|
|
374
|
-
id: string;
|
|
375
|
-
file: string;
|
|
376
|
-
className: string;
|
|
377
|
-
appliedAt: string;
|
|
378
|
-
checksum?: string;
|
|
379
|
-
}
|
|
380
|
-
interface AppliedMigrationRun {
|
|
381
|
-
id: string;
|
|
382
|
-
appliedAt: string;
|
|
383
|
-
migrationIds: string[];
|
|
384
|
-
}
|
|
385
|
-
interface AppliedMigrationsState {
|
|
386
|
-
version: 1;
|
|
387
|
-
migrations: AppliedMigrationEntry[];
|
|
388
|
-
runs?: AppliedMigrationRun[];
|
|
389
|
-
}
|
|
390
|
-
type MigrationClass = new () => MigrationInstanceLike;
|
|
391
|
-
//#endregion
|
|
392
392
|
//#region src/Collection.d.ts
|
|
393
393
|
declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
|
|
394
394
|
//#endregion
|
|
@@ -2771,6 +2771,10 @@ interface DatabaseAdapter {
|
|
|
2771
2771
|
exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
|
|
2772
2772
|
loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
|
|
2773
2773
|
introspectModels?: (options?: AdapterModelIntrospectionOptions) => Promise<AdapterModelStructure[]>;
|
|
2774
|
+
executeSchemaOperations?: (operations: SchemaOperation[]) => Promise<void>;
|
|
2775
|
+
resetDatabase?: () => Promise<void>;
|
|
2776
|
+
readAppliedMigrationsState?: () => Promise<AppliedMigrationsState>;
|
|
2777
|
+
writeAppliedMigrationsState?: (state: AppliedMigrationsState) => Promise<void>;
|
|
2774
2778
|
transaction: <TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext) => Promise<TResult>;
|
|
2775
2779
|
}
|
|
2776
2780
|
//#endregion
|
|
@@ -2787,8 +2791,29 @@ type KyselyTableMapping = Record<string, string>;
|
|
|
2787
2791
|
declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
2788
2792
|
private readonly db;
|
|
2789
2793
|
private readonly mapping;
|
|
2794
|
+
private static readonly migrationStateTable;
|
|
2795
|
+
private static readonly migrationRunTable;
|
|
2790
2796
|
readonly capabilities: AdapterCapabilities;
|
|
2791
2797
|
constructor(db: KyselyExecutor, mapping?: KyselyTableMapping);
|
|
2798
|
+
private quoteIdentifier;
|
|
2799
|
+
private quoteLiteral;
|
|
2800
|
+
private executeRawStatement;
|
|
2801
|
+
private resolveSchemaColumnName;
|
|
2802
|
+
private resolveSchemaIndexName;
|
|
2803
|
+
private resolveSchemaForeignKeyName;
|
|
2804
|
+
private resolveSchemaColumnType;
|
|
2805
|
+
private resolveSchemaColumnDefault;
|
|
2806
|
+
private shouldUseIdentity;
|
|
2807
|
+
private buildSchemaColumnDefinition;
|
|
2808
|
+
private buildSchemaForeignKeyConstraint;
|
|
2809
|
+
private buildSchemaIndexStatement;
|
|
2810
|
+
private ensureEnumTypes;
|
|
2811
|
+
private executeCreateTableOperation;
|
|
2812
|
+
private executeAlterTableOperation;
|
|
2813
|
+
private executeDropTableOperation;
|
|
2814
|
+
private ensureMigrationStateTables;
|
|
2815
|
+
private writeAppliedMigrationsStateInternal;
|
|
2816
|
+
private resetDatabaseInternal;
|
|
2792
2817
|
private introspectionTypeToTs;
|
|
2793
2818
|
private resolveTable;
|
|
2794
2819
|
private resolvePrimaryKey;
|
|
@@ -2914,6 +2939,10 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
2914
2939
|
*/
|
|
2915
2940
|
exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
|
|
2916
2941
|
introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
|
|
2942
|
+
executeSchemaOperations(operations: SchemaOperation[]): Promise<void>;
|
|
2943
|
+
resetDatabase(): Promise<void>;
|
|
2944
|
+
readAppliedMigrationsState(): Promise<AppliedMigrationsState>;
|
|
2945
|
+
writeAppliedMigrationsState(state: AppliedMigrationsState): Promise<void>;
|
|
2917
2946
|
/**
|
|
2918
2947
|
* Executes a series of database operations within a transaction.
|
|
2919
2948
|
* The provided callback function is called with a new instance of the
|
|
@@ -3473,6 +3502,15 @@ declare class MigrateCommand extends Command<CliApp> {
|
|
|
3473
3502
|
private loadMigrationClassesFromFile;
|
|
3474
3503
|
}
|
|
3475
3504
|
//#endregion
|
|
3505
|
+
//#region src/cli/commands/MigrateFreshCommand.d.ts
|
|
3506
|
+
declare class MigrateFreshCommand extends Command<CliApp> {
|
|
3507
|
+
protected signature: string;
|
|
3508
|
+
protected description: string;
|
|
3509
|
+
handle(): Promise<undefined>;
|
|
3510
|
+
private loadAllMigrations;
|
|
3511
|
+
private loadMigrationClassesFromFile;
|
|
3512
|
+
}
|
|
3513
|
+
//#endregion
|
|
3476
3514
|
//#region src/cli/commands/MigrateRollbackCommand.d.ts
|
|
3477
3515
|
/**
|
|
3478
3516
|
* Rollback migration classes from the Prisma schema and run Prisma workflow.
|
|
@@ -4113,11 +4151,16 @@ declare class UnsupportedAdapterFeatureException extends ArkormException {
|
|
|
4113
4151
|
}
|
|
4114
4152
|
//#endregion
|
|
4115
4153
|
//#region src/helpers/migration-history.d.ts
|
|
4154
|
+
declare const createEmptyAppliedMigrationsState: () => AppliedMigrationsState;
|
|
4155
|
+
declare const supportsDatabaseMigrationState: (adapter?: DatabaseAdapter) => adapter is DatabaseAdapter & Required<Pick<DatabaseAdapter, "readAppliedMigrationsState" | "writeAppliedMigrationsState">>;
|
|
4116
4156
|
declare const resolveMigrationStateFilePath: (cwd: string, configuredPath?: string) => string;
|
|
4117
4157
|
declare const buildMigrationIdentity: (filePath: string, className: string) => string;
|
|
4118
4158
|
declare const computeMigrationChecksum: (filePath: string) => string;
|
|
4119
4159
|
declare const readAppliedMigrationsState: (stateFilePath: string) => AppliedMigrationsState;
|
|
4160
|
+
declare const readAppliedMigrationsStateFromStore: (adapter: DatabaseAdapter | undefined, stateFilePath: string) => Promise<AppliedMigrationsState>;
|
|
4120
4161
|
declare const writeAppliedMigrationsState: (stateFilePath: string, state: AppliedMigrationsState) => void;
|
|
4162
|
+
declare const writeAppliedMigrationsStateToStore: (adapter: DatabaseAdapter | undefined, stateFilePath: string, state: AppliedMigrationsState) => Promise<void>;
|
|
4163
|
+
declare const deleteAppliedMigrationsStateFromStore: (adapter: DatabaseAdapter | undefined, stateFilePath: string) => Promise<"database" | "file" | "missing-file">;
|
|
4121
4164
|
declare const isMigrationApplied: (state: AppliedMigrationsState, identity: string, checksum?: string) => boolean;
|
|
4122
4165
|
declare const findAppliedMigration: (state: AppliedMigrationsState, identity: string) => AppliedMigrationEntry | undefined;
|
|
4123
4166
|
declare const markMigrationApplied: (state: AppliedMigrationsState, entry: AppliedMigrationEntry) => AppliedMigrationsState;
|
|
@@ -4372,6 +4415,15 @@ declare const generateMigrationFile: (name: string, options?: GenerateMigrationO
|
|
|
4372
4415
|
* @returns A promise that resolves to an array of schema operations that would be performed.
|
|
4373
4416
|
*/
|
|
4374
4417
|
declare const getMigrationPlan: (migration: Migration | (new () => Migration), direction?: "up" | "down") => Promise<SchemaOperation[]>;
|
|
4418
|
+
declare const supportsDatabaseMigrationExecution: (adapter?: DatabaseAdapter) => adapter is DatabaseAdapter & Required<Pick<DatabaseAdapter, "executeSchemaOperations">>;
|
|
4419
|
+
declare const supportsDatabaseReset: (adapter?: DatabaseAdapter) => adapter is DatabaseAdapter & Required<Pick<DatabaseAdapter, "resetDatabase">>;
|
|
4420
|
+
declare const stripPrismaSchemaModelsAndEnums: (schema: string) => string;
|
|
4421
|
+
declare const applyMigrationToDatabase: (adapter: DatabaseAdapter, migration: Migration | (new () => Migration)) => Promise<{
|
|
4422
|
+
operations: SchemaOperation[];
|
|
4423
|
+
}>;
|
|
4424
|
+
declare const applyMigrationRollbackToDatabase: (adapter: DatabaseAdapter, migration: Migration | (new () => Migration)) => Promise<{
|
|
4425
|
+
operations: SchemaOperation[];
|
|
4426
|
+
}>;
|
|
4375
4427
|
/**
|
|
4376
4428
|
* Apply the schema operations defined in a migration to a Prisma schema
|
|
4377
4429
|
* file, updating the file on disk if specified, and return the updated
|
|
@@ -4543,4 +4595,4 @@ declare class URLDriver {
|
|
|
4543
4595
|
url(page: number): string;
|
|
4544
4596
|
}
|
|
4545
4597
|
//#endregion
|
|
4546
|
-
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
|
4598
|
+
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, toMigrationFileSlug, toModelName, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore };
|