@veloxts/cli 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +23 -144
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/generate.d.ts +17 -0
  5. package/dist/commands/generate.d.ts.map +1 -0
  6. package/dist/commands/generate.js +219 -0
  7. package/dist/commands/generate.js.map +1 -0
  8. package/dist/commands/migrate.d.ts +8 -3
  9. package/dist/commands/migrate.d.ts.map +1 -1
  10. package/dist/commands/migrate.js +17 -123
  11. package/dist/commands/migrate.js.map +1 -1
  12. package/dist/generators/base.d.ts +76 -0
  13. package/dist/generators/base.d.ts.map +1 -0
  14. package/dist/generators/base.js +271 -0
  15. package/dist/generators/base.js.map +1 -0
  16. package/dist/generators/generators/index.d.ts +17 -0
  17. package/dist/generators/generators/index.d.ts.map +1 -0
  18. package/dist/generators/generators/index.js +43 -0
  19. package/dist/generators/generators/index.js.map +1 -0
  20. package/dist/generators/generators/migration.d.ts +43 -0
  21. package/dist/generators/generators/migration.d.ts.map +1 -0
  22. package/dist/generators/generators/migration.js +121 -0
  23. package/dist/generators/generators/migration.js.map +1 -0
  24. package/dist/generators/generators/model.d.ts +38 -0
  25. package/dist/generators/generators/model.d.ts.map +1 -0
  26. package/dist/generators/generators/model.js +108 -0
  27. package/dist/generators/generators/model.js.map +1 -0
  28. package/dist/generators/generators/procedure.d.ts +37 -0
  29. package/dist/generators/generators/procedure.d.ts.map +1 -0
  30. package/dist/generators/generators/procedure.js +99 -0
  31. package/dist/generators/generators/procedure.js.map +1 -0
  32. package/dist/generators/generators/resource.d.ts +29 -0
  33. package/dist/generators/generators/resource.d.ts.map +1 -0
  34. package/dist/generators/generators/resource.js +124 -0
  35. package/dist/generators/generators/resource.js.map +1 -0
  36. package/dist/generators/generators/schema.d.ts +28 -0
  37. package/dist/generators/generators/schema.d.ts.map +1 -0
  38. package/dist/generators/generators/schema.js +83 -0
  39. package/dist/generators/generators/schema.js.map +1 -0
  40. package/dist/generators/generators/test.d.ts +28 -0
  41. package/dist/generators/generators/test.d.ts.map +1 -0
  42. package/dist/generators/generators/test.js +96 -0
  43. package/dist/generators/generators/test.js.map +1 -0
  44. package/dist/generators/index.d.ts +16 -0
  45. package/dist/generators/index.d.ts.map +1 -0
  46. package/dist/generators/index.js +16 -0
  47. package/dist/generators/index.js.map +1 -0
  48. package/dist/generators/registry.d.ts +97 -0
  49. package/dist/generators/registry.d.ts.map +1 -0
  50. package/dist/generators/registry.js +253 -0
  51. package/dist/generators/registry.js.map +1 -0
  52. package/dist/generators/templates/migration.d.ts +23 -0
  53. package/dist/generators/templates/migration.d.ts.map +1 -0
  54. package/dist/generators/templates/migration.js +389 -0
  55. package/dist/generators/templates/migration.js.map +1 -0
  56. package/dist/generators/templates/model.d.ts +37 -0
  57. package/dist/generators/templates/model.d.ts.map +1 -0
  58. package/dist/generators/templates/model.js +374 -0
  59. package/dist/generators/templates/model.js.map +1 -0
  60. package/dist/generators/templates/procedure.d.ts +25 -0
  61. package/dist/generators/templates/procedure.d.ts.map +1 -0
  62. package/dist/generators/templates/procedure.js +274 -0
  63. package/dist/generators/templates/procedure.js.map +1 -0
  64. package/dist/generators/templates/resource.d.ts +34 -0
  65. package/dist/generators/templates/resource.d.ts.map +1 -0
  66. package/dist/generators/templates/resource.js +550 -0
  67. package/dist/generators/templates/resource.js.map +1 -0
  68. package/dist/generators/templates/schema.d.ts +33 -0
  69. package/dist/generators/templates/schema.d.ts.map +1 -0
  70. package/dist/generators/templates/schema.js +248 -0
  71. package/dist/generators/templates/schema.js.map +1 -0
  72. package/dist/generators/templates/test.d.ts +31 -0
  73. package/dist/generators/templates/test.d.ts.map +1 -0
  74. package/dist/generators/templates/test.js +882 -0
  75. package/dist/generators/templates/test.js.map +1 -0
  76. package/dist/generators/types.d.ts +211 -0
  77. package/dist/generators/types.d.ts.map +1 -0
  78. package/dist/generators/types.js +54 -0
  79. package/dist/generators/types.js.map +1 -0
  80. package/dist/generators/utils/filesystem.d.ts +68 -0
  81. package/dist/generators/utils/filesystem.d.ts.map +1 -0
  82. package/dist/generators/utils/filesystem.js +217 -0
  83. package/dist/generators/utils/filesystem.js.map +1 -0
  84. package/dist/generators/utils/naming.d.ts +122 -0
  85. package/dist/generators/utils/naming.d.ts.map +1 -0
  86. package/dist/generators/utils/naming.js +198 -0
  87. package/dist/generators/utils/naming.js.map +1 -0
  88. package/dist/index.d.ts +4 -0
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +4 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/migrations/commands/fresh.d.ts +11 -0
  93. package/dist/migrations/commands/fresh.d.ts.map +1 -0
  94. package/dist/migrations/commands/fresh.js +164 -0
  95. package/dist/migrations/commands/fresh.js.map +1 -0
  96. package/dist/migrations/commands/index.d.ts +11 -0
  97. package/dist/migrations/commands/index.d.ts.map +1 -0
  98. package/dist/migrations/commands/index.js +11 -0
  99. package/dist/migrations/commands/index.js.map +1 -0
  100. package/dist/migrations/commands/reset.d.ts +11 -0
  101. package/dist/migrations/commands/reset.d.ts.map +1 -0
  102. package/dist/migrations/commands/reset.js +258 -0
  103. package/dist/migrations/commands/reset.js.map +1 -0
  104. package/dist/migrations/commands/rollback.d.ts +11 -0
  105. package/dist/migrations/commands/rollback.d.ts.map +1 -0
  106. package/dist/migrations/commands/rollback.js +241 -0
  107. package/dist/migrations/commands/rollback.js.map +1 -0
  108. package/dist/migrations/commands/run.d.ts +11 -0
  109. package/dist/migrations/commands/run.d.ts.map +1 -0
  110. package/dist/migrations/commands/run.js +183 -0
  111. package/dist/migrations/commands/run.js.map +1 -0
  112. package/dist/migrations/commands/status.d.ts +11 -0
  113. package/dist/migrations/commands/status.d.ts.map +1 -0
  114. package/dist/migrations/commands/status.js +154 -0
  115. package/dist/migrations/commands/status.js.map +1 -0
  116. package/dist/migrations/errors.d.ts +74 -0
  117. package/dist/migrations/errors.d.ts.map +1 -0
  118. package/dist/migrations/errors.js +155 -0
  119. package/dist/migrations/errors.js.map +1 -0
  120. package/dist/migrations/index.d.ts +13 -0
  121. package/dist/migrations/index.d.ts.map +1 -0
  122. package/dist/migrations/index.js +17 -0
  123. package/dist/migrations/index.js.map +1 -0
  124. package/dist/migrations/loader.d.ts +44 -0
  125. package/dist/migrations/loader.d.ts.map +1 -0
  126. package/dist/migrations/loader.js +181 -0
  127. package/dist/migrations/loader.js.map +1 -0
  128. package/dist/migrations/prisma-wrapper.d.ts +60 -0
  129. package/dist/migrations/prisma-wrapper.d.ts.map +1 -0
  130. package/dist/migrations/prisma-wrapper.js +184 -0
  131. package/dist/migrations/prisma-wrapper.js.map +1 -0
  132. package/dist/migrations/rollback-runner.d.ts +40 -0
  133. package/dist/migrations/rollback-runner.d.ts.map +1 -0
  134. package/dist/migrations/rollback-runner.js +203 -0
  135. package/dist/migrations/rollback-runner.js.map +1 -0
  136. package/dist/migrations/types.d.ts +214 -0
  137. package/dist/migrations/types.d.ts.map +1 -0
  138. package/dist/migrations/types.js +19 -0
  139. package/dist/migrations/types.js.map +1 -0
  140. package/package.json +29 -8
@@ -0,0 +1,183 @@
1
+ /**
2
+ * migrate:run Command
3
+ *
4
+ * Run pending migrations.
5
+ */
6
+ import path from 'node:path';
7
+ import * as p from '@clack/prompts';
8
+ import { Command } from 'commander';
9
+ import pc from 'picocolors';
10
+ import { error, info, success, warning } from '../../utils/output.js';
11
+ import { fileExists } from '../../utils/paths.js';
12
+ import { MigrationError } from '../errors.js';
13
+ import { migrationsDirExists } from '../loader.js';
14
+ import { parseMigrateStatusOutput, prismaMigrateDeploy, prismaMigrateDev, prismaMigrateStatus, } from '../prisma-wrapper.js';
15
+ /**
16
+ * Create the migrate:run command
17
+ */
18
+ export function createMigrateRunCommand() {
19
+ return new Command('run')
20
+ .description('Run pending migrations')
21
+ .option('--dev', 'Use development mode (creates migration from schema changes)')
22
+ .option('--step <n>', 'Run only N migrations', parseInt)
23
+ .option('--dry-run', 'Show what would be run without executing')
24
+ .option('--json', 'Output as JSON')
25
+ .action(async (options) => {
26
+ await runMigrateRun(options);
27
+ });
28
+ }
29
+ /**
30
+ * Run migrate:run
31
+ */
32
+ async function runMigrateRun(options) {
33
+ const cwd = process.cwd();
34
+ const s = p.spinner();
35
+ try {
36
+ // Check if Prisma schema exists
37
+ const schemaPath = path.join(cwd, 'prisma', 'schema.prisma');
38
+ if (!fileExists(schemaPath)) {
39
+ if (options.json) {
40
+ console.log(JSON.stringify({ error: 'Prisma schema not found' }));
41
+ }
42
+ else {
43
+ error('Prisma schema not found.');
44
+ console.log(` ${pc.dim('Expected: prisma/schema.prisma')}`);
45
+ }
46
+ process.exit(1);
47
+ }
48
+ // Get current status to see what's pending
49
+ const hasDir = await migrationsDirExists(cwd);
50
+ if (!options.dev && !hasDir) {
51
+ if (options.json) {
52
+ console.log(JSON.stringify({ error: 'No migrations found' }));
53
+ }
54
+ else {
55
+ info('No migrations found.');
56
+ console.log(` ${pc.dim('Create one with: velox generate migration create_users')}`);
57
+ console.log(` ${pc.dim('Or use --dev to create from schema changes')}`);
58
+ }
59
+ return;
60
+ }
61
+ // Check for pending migrations
62
+ if (!options.dev && hasDir) {
63
+ const statusResult = await prismaMigrateStatus(cwd);
64
+ const parsed = parseMigrateStatusOutput(statusResult.output);
65
+ if (parsed.pending.length === 0) {
66
+ if (options.json) {
67
+ console.log(JSON.stringify({ message: 'No pending migrations', ran: 0 }));
68
+ }
69
+ else {
70
+ success('Database is already up to date!');
71
+ console.log(` ${pc.dim('All migrations have been applied.')}`);
72
+ }
73
+ return;
74
+ }
75
+ // Show pending migrations
76
+ if (!options.json) {
77
+ console.log('');
78
+ info(`${parsed.pending.length} pending migration${parsed.pending.length > 1 ? 's' : ''}`);
79
+ console.log('');
80
+ const toRun = options.step ? parsed.pending.slice(0, options.step) : parsed.pending;
81
+ for (const name of toRun) {
82
+ console.log(` ${pc.dim('→')} ${name}`);
83
+ }
84
+ console.log('');
85
+ if (options.step && options.step < parsed.pending.length) {
86
+ console.log(` ${pc.dim(`(Limiting to ${options.step} migration${options.step > 1 ? 's' : ''}. ${parsed.pending.length - options.step} remaining.)`)}`);
87
+ console.log('');
88
+ }
89
+ }
90
+ }
91
+ // Dry run - just show what would happen
92
+ if (options.dryRun) {
93
+ if (options.json) {
94
+ const statusResult = await prismaMigrateStatus(cwd);
95
+ const parsed = parseMigrateStatusOutput(statusResult.output);
96
+ const toRun = options.step ? parsed.pending.slice(0, options.step) : parsed.pending;
97
+ console.log(JSON.stringify({
98
+ dryRun: true,
99
+ wouldRun: toRun,
100
+ count: toRun.length,
101
+ }, null, 2));
102
+ }
103
+ else {
104
+ warning('Dry run mode - no changes made.');
105
+ console.log(` ${pc.dim('Remove --dry-run to apply migrations.')}`);
106
+ }
107
+ return;
108
+ }
109
+ // Execute migrations
110
+ if (!options.json) {
111
+ console.log('');
112
+ s.start('Running migrations...');
113
+ }
114
+ let result;
115
+ if (options.dev) {
116
+ // Development mode: prisma migrate dev
117
+ if (!options.json) {
118
+ s.stop('Starting Prisma Migrate Dev');
119
+ console.log('');
120
+ }
121
+ result = await prismaMigrateDev(cwd);
122
+ }
123
+ else {
124
+ // Production mode: prisma migrate deploy
125
+ if (!options.json) {
126
+ s.stop('Starting Prisma Migrate Deploy');
127
+ console.log('');
128
+ }
129
+ result = await prismaMigrateDeploy(cwd);
130
+ }
131
+ // Handle result
132
+ if (result.success) {
133
+ if (options.json) {
134
+ console.log(JSON.stringify({ success: true, message: 'Migrations applied' }));
135
+ }
136
+ else {
137
+ console.log('');
138
+ success('Migrations applied successfully!');
139
+ console.log('');
140
+ }
141
+ }
142
+ else {
143
+ if (options.json) {
144
+ console.log(JSON.stringify({ success: false, error: result.error }));
145
+ }
146
+ else {
147
+ console.log('');
148
+ error('Migration failed.');
149
+ if (result.error) {
150
+ console.log(` ${pc.dim(result.error)}`);
151
+ }
152
+ console.log('');
153
+ }
154
+ process.exit(1);
155
+ }
156
+ }
157
+ catch (err) {
158
+ s.stop('Migration failed');
159
+ if (options.json) {
160
+ if (err instanceof MigrationError) {
161
+ console.log(JSON.stringify({ error: err.toJSON() }));
162
+ }
163
+ else {
164
+ console.log(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
165
+ }
166
+ }
167
+ else {
168
+ console.log('');
169
+ if (err instanceof MigrationError) {
170
+ error(err.message);
171
+ if (err.fix) {
172
+ console.log(` ${pc.dim('Fix:')} ${err.fix}`);
173
+ }
174
+ }
175
+ else {
176
+ error(err instanceof Error ? err.message : String(err));
177
+ }
178
+ console.log('');
179
+ }
180
+ process.exit(1);
181
+ }
182
+ }
183
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/migrations/commands/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;SACtB,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,OAAO,EAAE,8DAA8D,CAAC;SAC/E,MAAM,CAAC,YAAY,EAAE,uBAAuB,EAAE,QAAQ,CA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,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,IAAI,GAAG,YAAY,cAAc,EAAE,CAAC;gBAClC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACnB,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;oBACZ,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * migrate:status Command
3
+ *
4
+ * Show migration status - which migrations are applied vs pending.
5
+ */
6
+ import { Command } from 'commander';
7
+ /**
8
+ * Create the migrate:status command
9
+ */
10
+ export declare function createMigrateStatusCommand(): Command;
11
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/migrations/commands/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAQpD"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * migrate:status Command
3
+ *
4
+ * Show migration status - which migrations are applied vs pending.
5
+ */
6
+ import path from 'node:path';
7
+ import { Command } from 'commander';
8
+ import pc from 'picocolors';
9
+ import { error, info, success, warning } from '../../utils/output.js';
10
+ import { fileExists } from '../../utils/paths.js';
11
+ import { MigrationError } from '../errors.js';
12
+ import { loadMigrations, migrationsDirExists } from '../loader.js';
13
+ import { parseMigrateStatusOutput, prismaMigrateStatus } from '../prisma-wrapper.js';
14
+ /**
15
+ * Create the migrate:status command
16
+ */
17
+ export function createMigrateStatusCommand() {
18
+ return new Command('status')
19
+ .description('Show migration status')
20
+ .option('--pending', 'Show only pending migrations')
21
+ .option('--json', 'Output as JSON')
22
+ .action(async (options) => {
23
+ await runMigrateStatus(options);
24
+ });
25
+ }
26
+ /**
27
+ * Run migrate:status
28
+ */
29
+ async function runMigrateStatus(options) {
30
+ const cwd = process.cwd();
31
+ try {
32
+ // Check if Prisma schema exists
33
+ const schemaPath = path.join(cwd, 'prisma', 'schema.prisma');
34
+ if (!fileExists(schemaPath)) {
35
+ if (options.json) {
36
+ console.log(JSON.stringify({ error: 'Prisma schema not found' }));
37
+ }
38
+ else {
39
+ error('Prisma schema not found.');
40
+ console.log(` ${pc.dim('Expected: prisma/schema.prisma')}`);
41
+ }
42
+ process.exit(1);
43
+ }
44
+ // Check if migrations directory exists
45
+ const hasDir = await migrationsDirExists(cwd);
46
+ if (!hasDir) {
47
+ if (options.json) {
48
+ console.log(JSON.stringify({ migrations: [], pending: 0, applied: 0 }));
49
+ }
50
+ else {
51
+ info('No migrations found.');
52
+ console.log(` ${pc.dim('Create one with: velox generate migration create_users')}`);
53
+ }
54
+ return;
55
+ }
56
+ // Get Prisma migrate status
57
+ const prismaResult = await prismaMigrateStatus(cwd);
58
+ const parsed = parseMigrateStatusOutput(prismaResult.output);
59
+ // Load migration files
60
+ const files = await loadMigrations(cwd);
61
+ // Build status list
62
+ const statuses = files.map((file) => {
63
+ const isApplied = parsed.applied.includes(file.name);
64
+ return {
65
+ name: file.name,
66
+ status: isApplied ? 'applied' : 'pending',
67
+ appliedAt: null, // We don't have exact date from prisma status output
68
+ hasRollback: file.hasRollback,
69
+ duration: null,
70
+ };
71
+ });
72
+ // Filter if --pending
73
+ const displayStatuses = options.pending
74
+ ? statuses.filter((s) => s.status === 'pending')
75
+ : statuses;
76
+ // JSON output
77
+ if (options.json) {
78
+ console.log(JSON.stringify({
79
+ migrations: displayStatuses,
80
+ pending: statuses.filter((s) => s.status === 'pending').length,
81
+ applied: statuses.filter((s) => s.status === 'applied').length,
82
+ total: statuses.length,
83
+ }, null, 2));
84
+ return;
85
+ }
86
+ // Pretty output
87
+ console.log('');
88
+ info('Migration Status');
89
+ console.log('');
90
+ if (displayStatuses.length === 0) {
91
+ if (options.pending) {
92
+ success('All migrations have been applied!');
93
+ }
94
+ else {
95
+ console.log(` ${pc.dim('No migrations found.')}`);
96
+ }
97
+ console.log('');
98
+ return;
99
+ }
100
+ // Print table header
101
+ console.log(` ${pc.dim('Status')} ${pc.dim('Migration')} ${pc.dim('Rollback')}`);
102
+ console.log(` ${pc.dim('─'.repeat(70))}`);
103
+ // Print each migration
104
+ for (const status of displayStatuses) {
105
+ const statusIcon = status.status === 'applied' ? pc.green('✓ Applied') : pc.yellow('○ Pending');
106
+ const rollbackIcon = status.hasRollback ? pc.green('Yes') : pc.dim('No');
107
+ // Truncate name if too long
108
+ const displayName = status.name.length > 40 ? `${status.name.slice(0, 37)}...` : status.name.padEnd(40);
109
+ console.log(` ${statusIcon} ${displayName} ${rollbackIcon}`);
110
+ }
111
+ console.log('');
112
+ // Summary
113
+ const pendingCount = statuses.filter((s) => s.status === 'pending').length;
114
+ const appliedCount = statuses.filter((s) => s.status === 'applied').length;
115
+ if (pendingCount > 0) {
116
+ warning(`${pendingCount} pending migration${pendingCount > 1 ? 's' : ''}`);
117
+ console.log(` ${pc.dim('Run:')} velox migrate:run`);
118
+ }
119
+ else {
120
+ success(`All ${appliedCount} migration${appliedCount > 1 ? 's' : ''} applied`);
121
+ }
122
+ // Show Prisma warnings if any
123
+ if (parsed.warnings.length > 0) {
124
+ console.log('');
125
+ for (const warn of parsed.warnings) {
126
+ warning(warn);
127
+ }
128
+ }
129
+ console.log('');
130
+ }
131
+ catch (err) {
132
+ if (options.json) {
133
+ if (err instanceof MigrationError) {
134
+ console.log(JSON.stringify({ error: err.toJSON() }));
135
+ }
136
+ else {
137
+ console.log(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
138
+ }
139
+ }
140
+ else {
141
+ if (err instanceof MigrationError) {
142
+ error(err.message);
143
+ if (err.fix) {
144
+ console.log(` ${pc.dim('Fix:')} ${err.fix}`);
145
+ }
146
+ }
147
+ else {
148
+ error(err instanceof Error ? err.message : String(err));
149
+ }
150
+ }
151
+ process.exit(1);
152
+ }
153
+ }
154
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/migrations/commands/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGrF;;GAEG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,OAAO,CAAC,QAAQ,C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C,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Migration Errors
3
+ *
4
+ * Error classes and codes for the migration runner system.
5
+ */
6
+ /**
7
+ * Error codes for migration operations
8
+ */
9
+ export type MigrationErrorCode = 'PRISMA_NOT_FOUND' | 'MIGRATIONS_DIR_NOT_FOUND' | 'MIGRATION_NOT_FOUND' | 'NO_ROLLBACK_FILE' | 'ROLLBACK_FAILED' | 'PRISMA_ERROR' | 'DATABASE_ERROR' | 'NO_PENDING_MIGRATIONS' | 'NO_APPLIED_MIGRATIONS' | 'CHECKSUM_MISMATCH';
10
+ /**
11
+ * Structured error for migration operations
12
+ */
13
+ export declare class MigrationError extends Error {
14
+ /** Error code for programmatic handling */
15
+ readonly code: MigrationErrorCode;
16
+ /** Additional context/details */
17
+ readonly details?: Record<string, unknown>;
18
+ /** Suggested fix (optional) */
19
+ readonly fix?: string;
20
+ constructor(code: MigrationErrorCode, message?: string, options?: {
21
+ details?: Record<string, unknown>;
22
+ fix?: string;
23
+ cause?: Error;
24
+ });
25
+ /**
26
+ * Format error for display
27
+ */
28
+ format(): string;
29
+ /**
30
+ * Convert to JSON for --json output
31
+ */
32
+ toJSON(): Record<string, unknown>;
33
+ }
34
+ /**
35
+ * Create error for missing Prisma CLI
36
+ */
37
+ export declare function prismaNotFound(): MigrationError;
38
+ /**
39
+ * Create error for missing migrations directory
40
+ */
41
+ export declare function migrationsDirNotFound(path: string): MigrationError;
42
+ /**
43
+ * Create error for migration not found
44
+ */
45
+ export declare function migrationNotFound(name: string): MigrationError;
46
+ /**
47
+ * Create error for missing rollback file
48
+ */
49
+ export declare function noRollbackFile(migration: string): MigrationError;
50
+ /**
51
+ * Create error for rollback failure
52
+ */
53
+ export declare function rollbackFailed(migration: string, cause: Error): MigrationError;
54
+ /**
55
+ * Create error for Prisma command failure
56
+ */
57
+ export declare function prismaError(command: string, output: string): MigrationError;
58
+ /**
59
+ * Create error for database operation failure
60
+ */
61
+ export declare function databaseError(operation: string, cause: Error): MigrationError;
62
+ /**
63
+ * Create error for no pending migrations
64
+ */
65
+ export declare function noPendingMigrations(): MigrationError;
66
+ /**
67
+ * Create error for no applied migrations
68
+ */
69
+ export declare function noAppliedMigrations(): MigrationError;
70
+ /**
71
+ * Create error for checksum mismatch
72
+ */
73
+ export declare function checksumMismatch(migration: string, expected: string, actual: string): MigrationError;
74
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/migrations/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,0BAA0B,GAC1B,qBAAqB,GACrB,kBAAkB,GAClB,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,uBAAuB,GACvB,uBAAuB,GACvB,mBAAmB,CAAC;AAsBxB;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,2CAA2C;IAC3C,SAAgB,IAAI,EAAE,kBAAkB,CAAC;IAEzC,iCAAiC;IACjC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElD,+BAA+B;IAC/B,SAAgB,GAAG,CAAC,EAAE,MAAM,CAAC;gBAG3B,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf;IAWH;;OAEG;IACH,MAAM,IAAI,MAAM;IAiBhB;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQlC;AAMD;;GAEG;AACH,wBAAgB,cAAc,IAAI,cAAc,CAI/C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAKlE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAK9D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAKhE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,CAK9E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAI3E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,CAK7E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAEpD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAEpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,cAAc,CAKhB"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Migration Errors
3
+ *
4
+ * Error classes and codes for the migration runner system.
5
+ */
6
+ /**
7
+ * Human-readable messages for error codes
8
+ */
9
+ const ERROR_MESSAGES = {
10
+ PRISMA_NOT_FOUND: 'Prisma CLI not found. Ensure @prisma/client is installed.',
11
+ MIGRATIONS_DIR_NOT_FOUND: 'Migrations directory not found.',
12
+ MIGRATION_NOT_FOUND: 'Migration not found.',
13
+ NO_ROLLBACK_FILE: 'No down.sql file found for migration.',
14
+ ROLLBACK_FAILED: 'Rollback failed.',
15
+ PRISMA_ERROR: 'Prisma command failed.',
16
+ DATABASE_ERROR: 'Database operation failed.',
17
+ NO_PENDING_MIGRATIONS: 'No pending migrations to run.',
18
+ NO_APPLIED_MIGRATIONS: 'No migrations have been applied.',
19
+ CHECKSUM_MISMATCH: 'Migration checksum does not match.',
20
+ };
21
+ // ============================================================================
22
+ // Migration Error Class
23
+ // ============================================================================
24
+ /**
25
+ * Structured error for migration operations
26
+ */
27
+ export class MigrationError extends Error {
28
+ /** Error code for programmatic handling */
29
+ code;
30
+ /** Additional context/details */
31
+ details;
32
+ /** Suggested fix (optional) */
33
+ fix;
34
+ constructor(code, message, options) {
35
+ const errorMessage = message ?? ERROR_MESSAGES[code];
36
+ super(errorMessage, { cause: options?.cause });
37
+ this.name = 'MigrationError';
38
+ this.code = code;
39
+ this.details = options?.details;
40
+ this.fix = options?.fix;
41
+ }
42
+ /**
43
+ * Format error for display
44
+ */
45
+ format() {
46
+ let output = `MigrationError[${this.code}]: ${this.message}`;
47
+ if (this.details && Object.keys(this.details).length > 0) {
48
+ output += '\n\n Details:';
49
+ for (const [key, value] of Object.entries(this.details)) {
50
+ output += `\n ${key}: ${String(value)}`;
51
+ }
52
+ }
53
+ if (this.fix) {
54
+ output += `\n\n Fix: ${this.fix}`;
55
+ }
56
+ return output;
57
+ }
58
+ /**
59
+ * Convert to JSON for --json output
60
+ */
61
+ toJSON() {
62
+ return {
63
+ code: this.code,
64
+ message: this.message,
65
+ details: this.details,
66
+ fix: this.fix,
67
+ };
68
+ }
69
+ }
70
+ // ============================================================================
71
+ // Error Factory Functions
72
+ // ============================================================================
73
+ /**
74
+ * Create error for missing Prisma CLI
75
+ */
76
+ export function prismaNotFound() {
77
+ return new MigrationError('PRISMA_NOT_FOUND', undefined, {
78
+ fix: 'Install Prisma: npm install @prisma/client prisma',
79
+ });
80
+ }
81
+ /**
82
+ * Create error for missing migrations directory
83
+ */
84
+ export function migrationsDirNotFound(path) {
85
+ return new MigrationError('MIGRATIONS_DIR_NOT_FOUND', `Migrations directory not found: ${path}`, {
86
+ details: { path },
87
+ fix: 'Create a migration with: velox generate migration create_users',
88
+ });
89
+ }
90
+ /**
91
+ * Create error for migration not found
92
+ */
93
+ export function migrationNotFound(name) {
94
+ return new MigrationError('MIGRATION_NOT_FOUND', `Migration not found: ${name}`, {
95
+ details: { name },
96
+ fix: 'Run "velox migrate:status" to see available migrations.',
97
+ });
98
+ }
99
+ /**
100
+ * Create error for missing rollback file
101
+ */
102
+ export function noRollbackFile(migration) {
103
+ return new MigrationError('NO_ROLLBACK_FILE', `No down.sql found for migration: ${migration}`, {
104
+ details: { migration },
105
+ fix: 'Create a down.sql file in the migration folder, or use "velox migrate:fresh" to reset.',
106
+ });
107
+ }
108
+ /**
109
+ * Create error for rollback failure
110
+ */
111
+ export function rollbackFailed(migration, cause) {
112
+ return new MigrationError('ROLLBACK_FAILED', `Failed to rollback migration: ${migration}`, {
113
+ details: { migration, originalError: cause.message },
114
+ cause,
115
+ });
116
+ }
117
+ /**
118
+ * Create error for Prisma command failure
119
+ */
120
+ export function prismaError(command, output) {
121
+ return new MigrationError('PRISMA_ERROR', `Prisma command failed: ${command}`, {
122
+ details: { command, output },
123
+ });
124
+ }
125
+ /**
126
+ * Create error for database operation failure
127
+ */
128
+ export function databaseError(operation, cause) {
129
+ return new MigrationError('DATABASE_ERROR', `Database operation failed: ${operation}`, {
130
+ details: { operation, originalError: cause.message },
131
+ cause,
132
+ });
133
+ }
134
+ /**
135
+ * Create error for no pending migrations
136
+ */
137
+ export function noPendingMigrations() {
138
+ return new MigrationError('NO_PENDING_MIGRATIONS', 'No pending migrations to run.');
139
+ }
140
+ /**
141
+ * Create error for no applied migrations
142
+ */
143
+ export function noAppliedMigrations() {
144
+ return new MigrationError('NO_APPLIED_MIGRATIONS', 'No migrations have been applied yet.');
145
+ }
146
+ /**
147
+ * Create error for checksum mismatch
148
+ */
149
+ export function checksumMismatch(migration, expected, actual) {
150
+ return new MigrationError('CHECKSUM_MISMATCH', `Migration checksum mismatch: ${migration}`, {
151
+ details: { migration, expected, actual },
152
+ fix: 'The migration file has been modified after it was applied. Use "velox migrate:fresh" to reset.',
153
+ });
154
+ }
155
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/migrations/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH;;GAEG;AACH,MAAM,cAAc,GAAuC;IACzD,gBAAgB,EAAE,2DAA2D;IAC7E,wBAAwB,EAAE,iCAAiC;IAC3D,mBAAmB,EAAE,sBAAsB;IAC3C,gBAAgB,EAAE,uCAAuC;IACzD,eAAe,EAAE,kBAAkB;IACnC,YAAY,EAAE,wBAAwB;IACtC,cAAc,EAAE,4BAA4B;IAC5C,qBAAqB,EAAE,+BAA+B;IACtD,qBAAqB,EAAE,kCAAkC;IACzD,iBAAiB,EAAE,oCAAoC;CACxD,CAAC;AAEF,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,2CAA2C;IAC3B,IAAI,CAAqB;IAEzC,iCAAiC;IACjB,OAAO,CAA2B;IAElD,+BAA+B;IACf,GAAG,CAAU;IAE7B,YACE,IAAwB,EACxB,OAAgB,EAChB,OAIC;QAED,MAAM,YAAY,GAAG,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;QACrD,KAAK,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,GAAG,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,MAAM,GAAG,kBAAkB,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AAI,cAAc,CAAC,uBAAuB,EAAE,sCAAsC,CAAC,CAAC;AAC7F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,QAAgB,EAChB,MAAc;IAEd,OAAO,IAAI,cAAc,CAAC,mBAAmB,EAAE,gCAAgC,SAAS,EAAE,EAAE;QAC1F,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE;QACxC,GAAG,EAAE,gGAAgG;KACtG,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Migration Runner
3
+ *
4
+ * Public API for the VeloxTS migration runner system.
5
+ */
6
+ export { createMigrateFreshCommand, createMigrateResetCommand, createMigrateRollbackCommand, createMigrateRunCommand, createMigrateStatusCommand, } from './commands/index.js';
7
+ export { checksumMismatch, databaseError, MigrationError, type MigrationErrorCode, migrationNotFound, migrationsDirNotFound, noAppliedMigrations, noPendingMigrations, noRollbackFile, prismaError, prismaNotFound, rollbackFailed, } from './errors.js';
8
+ export { computeMigrationStatus, DEFAULT_MIGRATIONS_PATH, getAppliedMigrationsWithRollback, getMigrationByName, getPendingMigrations, loadMigrations, migrationsDirExists, readMigrationSql, } from './loader.js';
9
+ export { isPrismaAvailable, type ParsedMigrationStatus, parseMigrateStatusOutput, prismaDbPush, prismaDbSeed, prismaMigrateDeploy, prismaMigrateDev, prismaMigrateReset, prismaMigrateStatus, runPrismaCommand, runPrismaCommandInteractive, } from './prisma-wrapper.js';
10
+ export { checkMigrationsTableExists, getAppliedMigrations, type RollbackOptions, rollbackAll, rollbackMigration, rollbackMultiple, } from './rollback-runner.js';
11
+ export type { BatchRollbackResult, DatabaseType, MigrateFreshOptions, MigrateResetOptions, MigrateRollbackOptions, MigrateRunOptions, MigrateStatusOptions, MigrationConfig, MigrationFile, MigrationStatus, MigrationStatusType, PrismaClientLike, PrismaMigrationRecord, PrismaResult, RollbackResult, } from './types.js';
12
+ export { createPrismaClient } from './types.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,wBAAwB,EACxB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,eAAe,EACpB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Migration Runner
3
+ *
4
+ * Public API for the VeloxTS migration runner system.
5
+ */
6
+ // Commands
7
+ export { createMigrateFreshCommand, createMigrateResetCommand, createMigrateRollbackCommand, createMigrateRunCommand, createMigrateStatusCommand, } from './commands/index.js';
8
+ // Errors
9
+ export { checksumMismatch, databaseError, MigrationError, migrationNotFound, migrationsDirNotFound, noAppliedMigrations, noPendingMigrations, noRollbackFile, prismaError, prismaNotFound, rollbackFailed, } from './errors.js';
10
+ // Loader
11
+ export { computeMigrationStatus, DEFAULT_MIGRATIONS_PATH, getAppliedMigrationsWithRollback, getMigrationByName, getPendingMigrations, loadMigrations, migrationsDirExists, readMigrationSql, } from './loader.js';
12
+ // Prisma Wrapper
13
+ export { isPrismaAvailable, parseMigrateStatusOutput, prismaDbPush, prismaDbSeed, prismaMigrateDeploy, prismaMigrateDev, prismaMigrateReset, prismaMigrateStatus, runPrismaCommand, runPrismaCommandInteractive, } from './prisma-wrapper.js';
14
+ // Rollback Runner
15
+ export { checkMigrationsTableExists, getAppliedMigrations, rollbackAll, rollbackMigration, rollbackMultiple, } from './rollback-runner.js';
16
+ export { createPrismaClient } from './types.js';
17
+ //# sourceMappingURL=index.js.map