@orchestr-sh/orchestr 1.5.10 → 1.6.0
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/README.md +433 -936
- package/dist/Console/Command.d.ts +59 -0
- package/dist/Console/Command.d.ts.map +1 -0
- package/dist/Console/Command.js +68 -0
- package/dist/Console/Command.js.map +1 -0
- package/dist/Console/Commands/MakeMigrationCommand.d.ts +15 -0
- package/dist/Console/Commands/MakeMigrationCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MakeMigrationCommand.js +41 -0
- package/dist/Console/Commands/MakeMigrationCommand.js.map +1 -0
- package/dist/Console/Commands/MakeSeederCommand.d.ts +23 -0
- package/dist/Console/Commands/MakeSeederCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MakeSeederCommand.js +109 -0
- package/dist/Console/Commands/MakeSeederCommand.js.map +1 -0
- package/dist/Console/Commands/MigrateCommand.d.ts +15 -0
- package/dist/Console/Commands/MigrateCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MigrateCommand.js +48 -0
- package/dist/Console/Commands/MigrateCommand.js.map +1 -0
- package/dist/Console/Commands/MigrateFreshCommand.d.ts +15 -0
- package/dist/Console/Commands/MigrateFreshCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MigrateFreshCommand.js +54 -0
- package/dist/Console/Commands/MigrateFreshCommand.js.map +1 -0
- package/dist/Console/Commands/MigrateRefreshCommand.d.ts +15 -0
- package/dist/Console/Commands/MigrateRefreshCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MigrateRefreshCommand.js +52 -0
- package/dist/Console/Commands/MigrateRefreshCommand.js.map +1 -0
- package/dist/Console/Commands/MigrateResetCommand.d.ts +15 -0
- package/dist/Console/Commands/MigrateResetCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MigrateResetCommand.js +46 -0
- package/dist/Console/Commands/MigrateResetCommand.js.map +1 -0
- package/dist/Console/Commands/MigrateRollbackCommand.d.ts +15 -0
- package/dist/Console/Commands/MigrateRollbackCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MigrateRollbackCommand.js +49 -0
- package/dist/Console/Commands/MigrateRollbackCommand.js.map +1 -0
- package/dist/Console/Commands/MigrateStatusCommand.d.ts +15 -0
- package/dist/Console/Commands/MigrateStatusCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MigrateStatusCommand.js +58 -0
- package/dist/Console/Commands/MigrateStatusCommand.js.map +1 -0
- package/dist/Console/Commands/SeedCommand.d.ts +15 -0
- package/dist/Console/Commands/SeedCommand.d.ts.map +1 -0
- package/dist/Console/Commands/SeedCommand.js +44 -0
- package/dist/Console/Commands/SeedCommand.js.map +1 -0
- package/dist/Console/ConsoleKernel.d.ts +45 -0
- package/dist/Console/ConsoleKernel.d.ts.map +1 -0
- package/dist/Console/ConsoleKernel.js +109 -0
- package/dist/Console/ConsoleKernel.js.map +1 -0
- package/dist/Console/orchestr.d.ts +8 -0
- package/dist/Console/orchestr.d.ts.map +1 -0
- package/dist/Console/orchestr.js +45 -0
- package/dist/Console/orchestr.js.map +1 -0
- package/dist/Database/Ensemble/Concerns/HasDynamicRelations.d.ts +5 -0
- package/dist/Database/Ensemble/Concerns/HasDynamicRelations.d.ts.map +1 -1
- package/dist/Database/Ensemble/Concerns/HasDynamicRelations.js.map +1 -1
- package/dist/Database/Ensemble/Concerns/HasRelationships.d.ts +20 -0
- package/dist/Database/Ensemble/Concerns/HasRelationships.d.ts.map +1 -1
- package/dist/Database/Ensemble/Concerns/HasRelationships.js +57 -0
- package/dist/Database/Ensemble/Concerns/HasRelationships.js.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphMany.d.ts +97 -0
- package/dist/Database/Ensemble/Relations/MorphMany.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphMany.js +189 -0
- package/dist/Database/Ensemble/Relations/MorphMany.js.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphMap.d.ts +59 -0
- package/dist/Database/Ensemble/Relations/MorphMap.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphMap.js +84 -0
- package/dist/Database/Ensemble/Relations/MorphMap.js.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphOne.d.ts +93 -0
- package/dist/Database/Ensemble/Relations/MorphOne.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphOne.js +179 -0
- package/dist/Database/Ensemble/Relations/MorphOne.js.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphTo.d.ts +98 -0
- package/dist/Database/Ensemble/Relations/MorphTo.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphTo.js +214 -0
- package/dist/Database/Ensemble/Relations/MorphTo.js.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphToMany.d.ts +73 -0
- package/dist/Database/Ensemble/Relations/MorphToMany.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphToMany.js +164 -0
- package/dist/Database/Ensemble/Relations/MorphToMany.js.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphedByMany.d.ts +29 -0
- package/dist/Database/Ensemble/Relations/MorphedByMany.d.ts.map +1 -0
- package/dist/Database/Ensemble/Relations/MorphedByMany.js +58 -0
- package/dist/Database/Ensemble/Relations/MorphedByMany.js.map +1 -0
- package/dist/Database/Ensemble/Relations/index.d.ts +6 -0
- package/dist/Database/Ensemble/Relations/index.d.ts.map +1 -1
- package/dist/Database/Ensemble/Relations/index.js +14 -1
- package/dist/Database/Ensemble/Relations/index.js.map +1 -1
- package/dist/Database/Migrations/Blueprint.d.ts +166 -0
- package/dist/Database/Migrations/Blueprint.d.ts.map +1 -0
- package/dist/Database/Migrations/Blueprint.js +318 -0
- package/dist/Database/Migrations/Blueprint.js.map +1 -0
- package/dist/Database/Migrations/ColumnDefinition.d.ts +62 -0
- package/dist/Database/Migrations/ColumnDefinition.d.ts.map +1 -0
- package/dist/Database/Migrations/ColumnDefinition.js +95 -0
- package/dist/Database/Migrations/ColumnDefinition.js.map +1 -0
- package/dist/Database/Migrations/ForeignKeyDefinition.d.ts +32 -0
- package/dist/Database/Migrations/ForeignKeyDefinition.d.ts.map +1 -0
- package/dist/Database/Migrations/ForeignKeyDefinition.js +50 -0
- package/dist/Database/Migrations/ForeignKeyDefinition.js.map +1 -0
- package/dist/Database/Migrations/Migration.d.ts +17 -0
- package/dist/Database/Migrations/Migration.d.ts.map +1 -0
- package/dist/Database/Migrations/Migration.js +12 -0
- package/dist/Database/Migrations/Migration.js.map +1 -0
- package/dist/Database/Migrations/MigrationCreator.d.ts +42 -0
- package/dist/Database/Migrations/MigrationCreator.d.ts.map +1 -0
- package/dist/Database/Migrations/MigrationCreator.js +184 -0
- package/dist/Database/Migrations/MigrationCreator.js.map +1 -0
- package/dist/Database/Migrations/MigrationRepository.d.ts +65 -0
- package/dist/Database/Migrations/MigrationRepository.d.ts.map +1 -0
- package/dist/Database/Migrations/MigrationRepository.js +135 -0
- package/dist/Database/Migrations/MigrationRepository.js.map +1 -0
- package/dist/Database/Migrations/Migrator.d.ts +84 -0
- package/dist/Database/Migrations/Migrator.d.ts.map +1 -0
- package/dist/Database/Migrations/Migrator.js +239 -0
- package/dist/Database/Migrations/Migrator.js.map +1 -0
- package/dist/Database/Migrations/SchemaBuilder.d.ts +136 -0
- package/dist/Database/Migrations/SchemaBuilder.d.ts.map +1 -0
- package/dist/Database/Migrations/SchemaBuilder.js +515 -0
- package/dist/Database/Migrations/SchemaBuilder.js.map +1 -0
- package/dist/Database/Seeders/Seeder.d.ts +29 -0
- package/dist/Database/Seeders/Seeder.d.ts.map +1 -0
- package/dist/Database/Seeders/Seeder.js +41 -0
- package/dist/Database/Seeders/Seeder.js.map +1 -0
- package/dist/Database/Seeders/SeederRunner.d.ts +41 -0
- package/dist/Database/Seeders/SeederRunner.d.ts.map +1 -0
- package/dist/Database/Seeders/SeederRunner.js +134 -0
- package/dist/Database/Seeders/SeederRunner.js.map +1 -0
- package/dist/index.d.ts +27 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command
|
|
3
|
+
*
|
|
4
|
+
* Base class for all console commands
|
|
5
|
+
*/
|
|
6
|
+
export interface CommandOptions {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class Command {
|
|
10
|
+
/**
|
|
11
|
+
* The name of the command
|
|
12
|
+
*/
|
|
13
|
+
abstract signature: string;
|
|
14
|
+
/**
|
|
15
|
+
* The description of the command
|
|
16
|
+
*/
|
|
17
|
+
abstract description: string;
|
|
18
|
+
/**
|
|
19
|
+
* Execute the command
|
|
20
|
+
*/
|
|
21
|
+
abstract handle(args: string[], options: CommandOptions): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Write a message to the console
|
|
24
|
+
*/
|
|
25
|
+
protected info(message: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Write an error message to the console
|
|
28
|
+
*/
|
|
29
|
+
protected error(message: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Write a warning message to the console
|
|
32
|
+
*/
|
|
33
|
+
protected warn(message: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Write a comment message to the console
|
|
36
|
+
*/
|
|
37
|
+
protected comment(message: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Write a question message to the console
|
|
40
|
+
*/
|
|
41
|
+
protected question(message: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Write a line to the console
|
|
44
|
+
*/
|
|
45
|
+
protected line(message?: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Write a newline to the console
|
|
48
|
+
*/
|
|
49
|
+
protected newLine(count?: number): void;
|
|
50
|
+
/**
|
|
51
|
+
* Write a table to the console
|
|
52
|
+
*/
|
|
53
|
+
protected table(headers: string[], rows: any[][]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get the command name from the signature
|
|
56
|
+
*/
|
|
57
|
+
getName(): string;
|
|
58
|
+
}
|
|
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
+
* Command
|
|
4
|
+
*
|
|
5
|
+
* Base class for all console commands
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Command = void 0;
|
|
9
|
+
class Command {
|
|
10
|
+
/**
|
|
11
|
+
* Write a message to the console
|
|
12
|
+
*/
|
|
13
|
+
info(message) {
|
|
14
|
+
console.log(`\x1b[32m${message}\x1b[0m`);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Write an error message to the console
|
|
18
|
+
*/
|
|
19
|
+
error(message) {
|
|
20
|
+
console.error(`\x1b[31m${message}\x1b[0m`);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Write a warning message to the console
|
|
24
|
+
*/
|
|
25
|
+
warn(message) {
|
|
26
|
+
console.warn(`\x1b[33m${message}\x1b[0m`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Write a comment message to the console
|
|
30
|
+
*/
|
|
31
|
+
comment(message) {
|
|
32
|
+
console.log(`\x1b[90m${message}\x1b[0m`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Write a question message to the console
|
|
36
|
+
*/
|
|
37
|
+
question(message) {
|
|
38
|
+
console.log(`\x1b[36m${message}\x1b[0m`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Write a line to the console
|
|
42
|
+
*/
|
|
43
|
+
line(message = '') {
|
|
44
|
+
console.log(message);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Write a newline to the console
|
|
48
|
+
*/
|
|
49
|
+
newLine(count = 1) {
|
|
50
|
+
for (let i = 0; i < count; i++) {
|
|
51
|
+
console.log();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Write a table to the console
|
|
56
|
+
*/
|
|
57
|
+
table(headers, rows) {
|
|
58
|
+
console.table(rows, headers);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the command name from the signature
|
|
62
|
+
*/
|
|
63
|
+
getName() {
|
|
64
|
+
return this.signature.split(' ')[0];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Command = Command;
|
|
68
|
+
//# sourceMappingURL=Command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../src/Console/Command.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAMH,MAAsB,OAAO;IAgB3B;;OAEG;IACO,IAAI,CAAC,OAAe;QAC5B,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,OAAe;QAC7B,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,SAAS,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,IAAI,CAAC,OAAe;QAC5B,OAAO,CAAC,IAAI,CAAC,WAAW,OAAO,SAAS,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,OAAe;QAC/B,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAe;QAChC,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACO,IAAI,CAAC,UAAkB,EAAE;QACjC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,QAAgB,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,OAAiB,EAAE,IAAa;QAC9C,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;CACF;AAhFD,0BAgFC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MakeMigrationCommand
|
|
3
|
+
*
|
|
4
|
+
* Create a new migration file
|
|
5
|
+
*/
|
|
6
|
+
import { Command, CommandOptions } from '../Command';
|
|
7
|
+
import { Application } from '../../Foundation/Application';
|
|
8
|
+
export declare class MakeMigrationCommand extends Command {
|
|
9
|
+
protected app: Application;
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(app: Application);
|
|
13
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=MakeMigrationCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MakeMigrationCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MakeMigrationCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,oBAAqB,SAAQ,OAAO;IAInC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAA2B;IACpC,WAAW,SAAiC;gBAEtB,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAwBrE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MakeMigrationCommand
|
|
4
|
+
*
|
|
5
|
+
* Create a new migration file
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MakeMigrationCommand = void 0;
|
|
9
|
+
const Command_1 = require("../Command");
|
|
10
|
+
const MigrationCreator_1 = require("../../Database/Migrations/MigrationCreator");
|
|
11
|
+
class MakeMigrationCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'make:migration <name>';
|
|
14
|
+
description = 'Create a new migration file';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(args, options) {
|
|
20
|
+
const name = args[0];
|
|
21
|
+
if (!name) {
|
|
22
|
+
this.error('Migration name is required.');
|
|
23
|
+
this.line('Usage: make:migration <name>');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const migrationPath = options.path || './database/migrations';
|
|
27
|
+
const table = options.table;
|
|
28
|
+
const create = options.create === true;
|
|
29
|
+
const creator = new MigrationCreator_1.MigrationCreator();
|
|
30
|
+
try {
|
|
31
|
+
const filePath = await creator.create(name, migrationPath, table, create);
|
|
32
|
+
this.info(`Migration created successfully: ${filePath}`);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
this.error(`Failed to create migration: ${error.message}`);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.MakeMigrationCommand = MakeMigrationCommand;
|
|
41
|
+
//# sourceMappingURL=MakeMigrationCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MakeMigrationCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/MakeMigrationCommand.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wCAAqD;AAErD,iFAA8E;AAE9E,MAAa,oBAAqB,SAAQ,iBAAO;IAIzB;IAHtB,SAAS,GAAG,uBAAuB,CAAC;IACpC,WAAW,GAAG,6BAA6B,CAAC;IAE5C,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAc,EAAE,OAAuB;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAErB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,IAAI,uBAAuB,CAAC;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAA2B,CAAC;QAClD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;QAEvC,MAAM,OAAO,GAAG,IAAI,mCAAgB,EAAE,CAAC;QAEvC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YAE1E,IAAI,CAAC,IAAI,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,+BAAgC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YACtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAhCD,oDAgCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MakeSeederCommand
|
|
3
|
+
*
|
|
4
|
+
* Create a new seeder class
|
|
5
|
+
*/
|
|
6
|
+
import { Command, CommandOptions } from '../Command';
|
|
7
|
+
import { Application } from '../../Foundation/Application';
|
|
8
|
+
export declare class MakeSeederCommand extends Command {
|
|
9
|
+
protected app: Application;
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(app: Application);
|
|
13
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new seeder file
|
|
16
|
+
*/
|
|
17
|
+
protected createSeeder(name: string, seederPath: string): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Get the seeder stub
|
|
20
|
+
*/
|
|
21
|
+
protected getStub(name: string): string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=MakeSeederCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MakeSeederCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MakeSeederCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,qBAAa,iBAAkB,SAAQ,OAAO;IAIhC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAwB;IACjC,WAAW,SAA+B;gBAEpB,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBpE;;OAEG;cACa,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB/E;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAiBxC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MakeSeederCommand
|
|
4
|
+
*
|
|
5
|
+
* Create a new seeder class
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.MakeSeederCommand = void 0;
|
|
42
|
+
const Command_1 = require("../Command");
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
class MakeSeederCommand extends Command_1.Command {
|
|
46
|
+
app;
|
|
47
|
+
signature = 'make:seeder <name>';
|
|
48
|
+
description = 'Create a new seeder class';
|
|
49
|
+
constructor(app) {
|
|
50
|
+
super();
|
|
51
|
+
this.app = app;
|
|
52
|
+
}
|
|
53
|
+
async handle(args, options) {
|
|
54
|
+
const name = args[0];
|
|
55
|
+
if (!name) {
|
|
56
|
+
this.error('Seeder name is required.');
|
|
57
|
+
this.line('Usage: make:seeder <name>');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const seederPath = options.path || './database/seeders';
|
|
61
|
+
try {
|
|
62
|
+
const filePath = await this.createSeeder(name, seederPath);
|
|
63
|
+
this.info(`Seeder created successfully: ${filePath}`);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
this.error(`Failed to create seeder: ${error.message}`);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a new seeder file
|
|
72
|
+
*/
|
|
73
|
+
async createSeeder(name, seederPath) {
|
|
74
|
+
// Ensure directory exists
|
|
75
|
+
if (!fs.existsSync(seederPath)) {
|
|
76
|
+
fs.mkdirSync(seederPath, { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
const fileName = `${name}.ts`;
|
|
79
|
+
const filePath = path.join(seederPath, fileName);
|
|
80
|
+
if (fs.existsSync(filePath)) {
|
|
81
|
+
throw new Error(`Seeder already exists: ${filePath}`);
|
|
82
|
+
}
|
|
83
|
+
const stub = this.getStub(name);
|
|
84
|
+
fs.writeFileSync(filePath, stub);
|
|
85
|
+
return filePath;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get the seeder stub
|
|
89
|
+
*/
|
|
90
|
+
getStub(name) {
|
|
91
|
+
return `import { Seeder } from '@orchestr-sh/orchestr';
|
|
92
|
+
|
|
93
|
+
export default class ${name} extends Seeder {
|
|
94
|
+
/**
|
|
95
|
+
* Run the database seeds
|
|
96
|
+
*/
|
|
97
|
+
async run(): Promise<void> {
|
|
98
|
+
// Example: Insert data into database
|
|
99
|
+
// await this.connection?.table('users').insert({
|
|
100
|
+
// name: 'John Doe',
|
|
101
|
+
// email: 'john@example.com',
|
|
102
|
+
// });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.MakeSeederCommand = MakeSeederCommand;
|
|
109
|
+
//# sourceMappingURL=MakeSeederCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MakeSeederCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/MakeSeederCommand.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAqD;AAErD,uCAAyB;AACzB,2CAA6B;AAE7B,MAAa,iBAAkB,SAAQ,iBAAO;IAItB;IAHtB,SAAS,GAAG,oBAAoB,CAAC;IACjC,WAAW,GAAG,2BAA2B,CAAC;IAE1C,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAc,EAAE,OAAuB;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAErB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACvC,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,oBAAoB,CAAC;QAExD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAE3D,IAAI,CAAC,IAAI,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,4BAA6B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YACnE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,UAAkB;QAC3D,0BAA0B;QAC1B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,QAAQ,GAAG,GAAG,IAAI,KAAK,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAEjD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,IAAY;QAC5B,OAAO;;uBAEY,IAAI;;;;;;;;;;;;CAY1B,CAAC;IACA,CAAC;CACF;AAvED,8CAuEC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MigrateCommand
|
|
3
|
+
*
|
|
4
|
+
* Run the database migrations
|
|
5
|
+
*/
|
|
6
|
+
import { Command, CommandOptions } from '../Command';
|
|
7
|
+
import { Application } from '../../Foundation/Application';
|
|
8
|
+
export declare class MigrateCommand extends Command {
|
|
9
|
+
protected app: Application;
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(app: Application);
|
|
13
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=MigrateCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,cAAe,SAAQ,OAAO;IAI7B,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAa;IACtB,WAAW,SAAiC;gBAEtB,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAgCrE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MigrateCommand
|
|
4
|
+
*
|
|
5
|
+
* Run the database migrations
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MigrateCommand = void 0;
|
|
9
|
+
const Command_1 = require("../Command");
|
|
10
|
+
const Migrator_1 = require("../../Database/Migrations/Migrator");
|
|
11
|
+
class MigrateCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'migrate';
|
|
14
|
+
description = 'Run the database migrations';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(args, options) {
|
|
20
|
+
const db = this.app.make('db');
|
|
21
|
+
const connection = db.connection();
|
|
22
|
+
const migrationPath = options.path || './database/migrations';
|
|
23
|
+
const paths = Array.isArray(migrationPath) ? migrationPath : [migrationPath];
|
|
24
|
+
const migrator = new Migrator_1.Migrator(connection, paths);
|
|
25
|
+
this.info('Running migrations...');
|
|
26
|
+
this.newLine();
|
|
27
|
+
try {
|
|
28
|
+
const ran = await migrator.run({
|
|
29
|
+
pretend: options.pretend === true,
|
|
30
|
+
});
|
|
31
|
+
if (ran.length === 0) {
|
|
32
|
+
this.comment('Nothing to migrate.');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
ran.forEach((migration) => {
|
|
36
|
+
this.info(`Migrated: ${migration}`);
|
|
37
|
+
});
|
|
38
|
+
this.newLine();
|
|
39
|
+
this.info(`Migration completed successfully.`);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
this.error(`Migration failed: ${error.message}`);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.MigrateCommand = MigrateCommand;
|
|
48
|
+
//# sourceMappingURL=MigrateCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateCommand.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wCAAqD;AAErD,iEAA8D;AAE9D,MAAa,cAAe,SAAQ,iBAAO;IAInB;IAHtB,SAAS,GAAG,SAAS,CAAC;IACtB,WAAW,GAAG,6BAA6B,CAAC;IAE5C,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAc,EAAE,OAAuB;QAClD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAQ,CAAC;QACtC,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,IAAI,uBAAuB,CAAC;QAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAE7E,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QAEf,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC;gBAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI;aAClC,CAAC,CAAC;YAEH,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;gBACpC,OAAO;YACT,CAAC;YAED,GAAG,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBACxB,IAAI,CAAC,IAAI,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,qBAAsB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAxCD,wCAwCC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MigrateFreshCommand
|
|
3
|
+
*
|
|
4
|
+
* Drop all tables and re-run all migrations
|
|
5
|
+
*/
|
|
6
|
+
import { Command, CommandOptions } from '../Command';
|
|
7
|
+
import { Application } from '../../Foundation/Application';
|
|
8
|
+
export declare class MigrateFreshCommand extends Command {
|
|
9
|
+
protected app: Application;
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(app: Application);
|
|
13
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=MigrateFreshCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateFreshCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateFreshCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,qBAAa,mBAAoB,SAAQ,OAAO;IAIlC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAmB;IAC5B,WAAW,SAA+C;gBAEpC,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCrE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MigrateFreshCommand
|
|
4
|
+
*
|
|
5
|
+
* Drop all tables and re-run all migrations
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MigrateFreshCommand = void 0;
|
|
9
|
+
const Command_1 = require("../Command");
|
|
10
|
+
const Migrator_1 = require("../../Database/Migrations/Migrator");
|
|
11
|
+
const SchemaBuilder_1 = require("../../Database/Migrations/SchemaBuilder");
|
|
12
|
+
class MigrateFreshCommand extends Command_1.Command {
|
|
13
|
+
app;
|
|
14
|
+
signature = 'migrate:fresh';
|
|
15
|
+
description = 'Drop all tables and re-run all migrations';
|
|
16
|
+
constructor(app) {
|
|
17
|
+
super();
|
|
18
|
+
this.app = app;
|
|
19
|
+
}
|
|
20
|
+
async handle(args, options) {
|
|
21
|
+
const db = this.app.make('db');
|
|
22
|
+
const connection = db.connection();
|
|
23
|
+
const migrationPath = options.path || './database/migrations';
|
|
24
|
+
const paths = Array.isArray(migrationPath) ? migrationPath : [migrationPath];
|
|
25
|
+
const schema = new SchemaBuilder_1.SchemaBuilder(connection);
|
|
26
|
+
const migrator = new Migrator_1.Migrator(connection, paths);
|
|
27
|
+
this.warn('This command will drop all tables. Are you sure you want to continue?');
|
|
28
|
+
this.newLine();
|
|
29
|
+
try {
|
|
30
|
+
// Drop all tables
|
|
31
|
+
this.info('Dropping all tables...');
|
|
32
|
+
const repository = migrator.getRepository();
|
|
33
|
+
await repository.deleteRepository();
|
|
34
|
+
this.newLine();
|
|
35
|
+
// Re-run all migrations
|
|
36
|
+
this.info('Running migrations...');
|
|
37
|
+
this.newLine();
|
|
38
|
+
const ran = await migrator.run();
|
|
39
|
+
if (ran.length > 0) {
|
|
40
|
+
ran.forEach((migration) => {
|
|
41
|
+
this.info(`Migrated: ${migration}`);
|
|
42
|
+
});
|
|
43
|
+
this.newLine();
|
|
44
|
+
}
|
|
45
|
+
this.info(`Database fresh completed successfully.`);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
this.error(`Fresh migration failed: ${error.message}`);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.MigrateFreshCommand = MigrateFreshCommand;
|
|
54
|
+
//# sourceMappingURL=MigrateFreshCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateFreshCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateFreshCommand.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wCAAqD;AAErD,iEAA8D;AAC9D,2EAAwE;AAExE,MAAa,mBAAoB,SAAQ,iBAAO;IAIxB;IAHtB,SAAS,GAAG,eAAe,CAAC;IAC5B,WAAW,GAAG,2CAA2C,CAAC;IAE1D,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAc,EAAE,OAAuB;QAClD,MAAM,EAAE,G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KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,2BAA4B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA9CD,kDA8CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MigrateRefreshCommand
|
|
3
|
+
*
|
|
4
|
+
* Reset and re-run all migrations
|
|
5
|
+
*/
|
|
6
|
+
import { Command, CommandOptions } from '../Command';
|
|
7
|
+
import { Application } from '../../Foundation/Application';
|
|
8
|
+
export declare class MigrateRefreshCommand extends Command {
|
|
9
|
+
protected app: Application;
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(app: Application);
|
|
13
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=MigrateRefreshCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateRefreshCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateRefreshCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,qBAAsB,SAAQ,OAAO;IAIpC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAqB;IAC9B,WAAW,SAAqC;gBAE1B,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAoCrE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MigrateRefreshCommand
|
|
4
|
+
*
|
|
5
|
+
* Reset and re-run all migrations
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MigrateRefreshCommand = void 0;
|
|
9
|
+
const Command_1 = require("../Command");
|
|
10
|
+
const Migrator_1 = require("../../Database/Migrations/Migrator");
|
|
11
|
+
class MigrateRefreshCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'migrate:refresh';
|
|
14
|
+
description = 'Reset and re-run all migrations';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(args, options) {
|
|
20
|
+
const db = this.app.make('db');
|
|
21
|
+
const connection = db.connection();
|
|
22
|
+
const migrationPath = options.path || './database/migrations';
|
|
23
|
+
const paths = Array.isArray(migrationPath) ? migrationPath : [migrationPath];
|
|
24
|
+
const migrator = new Migrator_1.Migrator(connection, paths);
|
|
25
|
+
this.info('Refreshing database...');
|
|
26
|
+
this.newLine();
|
|
27
|
+
try {
|
|
28
|
+
const result = await migrator.refresh();
|
|
29
|
+
if (result.rolledBack.length > 0) {
|
|
30
|
+
this.comment('Rolled back:');
|
|
31
|
+
result.rolledBack.forEach((migration) => {
|
|
32
|
+
this.info(` ${migration}`);
|
|
33
|
+
});
|
|
34
|
+
this.newLine();
|
|
35
|
+
}
|
|
36
|
+
if (result.ran.length > 0) {
|
|
37
|
+
this.comment('Migrated:');
|
|
38
|
+
result.ran.forEach((migration) => {
|
|
39
|
+
this.info(` ${migration}`);
|
|
40
|
+
});
|
|
41
|
+
this.newLine();
|
|
42
|
+
}
|
|
43
|
+
this.info(`Database refresh completed successfully.`);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
this.error(`Refresh failed: ${error.message}`);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.MigrateRefreshCommand = MigrateRefreshCommand;
|
|
52
|
+
//# sourceMappingURL=MigrateRefreshCommand.js.map
|
|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AC9B,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,CAAC;YAED,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBAC1B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;oBAC/B,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;gBAC9B,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,mBAAoB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA5CD,sDA4CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MigrateResetCommand
|
|
3
|
+
*
|
|
4
|
+
* Rollback all database migrations
|
|
5
|
+
*/
|
|
6
|
+
import { Command, CommandOptions } from '../Command';
|
|
7
|
+
import { Application } from '../../Foundation/Application';
|
|
8
|
+
export declare class MigrateResetCommand extends Command {
|
|
9
|
+
protected app: Application;
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(app: Application);
|
|
13
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=MigrateResetCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateResetCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateResetCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,mBAAoB,SAAQ,OAAO;IAIlC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAmB;IAC5B,WAAW,SAAsC;gBAE3B,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA8BrE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MigrateResetCommand
|
|
4
|
+
*
|
|
5
|
+
* Rollback all database migrations
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MigrateResetCommand = void 0;
|
|
9
|
+
const Command_1 = require("../Command");
|
|
10
|
+
const Migrator_1 = require("../../Database/Migrations/Migrator");
|
|
11
|
+
class MigrateResetCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'migrate:reset';
|
|
14
|
+
description = 'Rollback all database migrations';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(args, options) {
|
|
20
|
+
const db = this.app.make('db');
|
|
21
|
+
const connection = db.connection();
|
|
22
|
+
const migrationPath = options.path || './database/migrations';
|
|
23
|
+
const paths = Array.isArray(migrationPath) ? migrationPath : [migrationPath];
|
|
24
|
+
const migrator = new Migrator_1.Migrator(connection, paths);
|
|
25
|
+
this.info('Resetting database...');
|
|
26
|
+
this.newLine();
|
|
27
|
+
try {
|
|
28
|
+
const rolledBack = await migrator.reset();
|
|
29
|
+
if (rolledBack.length === 0) {
|
|
30
|
+
this.comment('Nothing to rollback.');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
rolledBack.forEach((migration) => {
|
|
34
|
+
this.info(`Rolled back: ${migration}`);
|
|
35
|
+
});
|
|
36
|
+
this.newLine();
|
|
37
|
+
this.info(`Database reset completed successfully.`);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
this.error(`Reset failed: ${error.message}`);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.MigrateResetCommand = MigrateResetCommand;
|
|
46
|
+
//# sourceMappingURL=MigrateResetCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateResetCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/MigrateResetCommand.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wCAAqD;AAErD,iEAA8D;AAE9D,MAAa,mBAAoB,SAAQ,iBAAO;IAIxB;IAHtB,SAAS,GAAG,eAAe,CAAC;IAC5B,WAAW,GAAG,kCAAkC,CAAC;IAEjD,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAc,EAAE,OAAuB;QAClD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAQ,CAAC;QACtC,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,IAAI,uBAAuB,CAAC;QAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAE7E,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QAEf,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,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