Skip to content

Commit 40f51c3

Browse files
committed
chore: wip
1 parent c6af3bb commit 40f51c3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.stacks/core/buddy/src/commands/migrate.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { migrations } from '@stacksjs/actions/generate'
21
import type { CLI, FreshOptions } from '@stacksjs/types'
2+
import { runAction } from '@stacksjs/actions'
3+
import { intro, outro } from '@stacksjs/cli'
4+
import { Action, ExitCode } from '@stacksjs/types'
35

46
async function migrate(buddy: CLI) {
57
const descriptions = {
@@ -13,7 +15,18 @@ async function migrate(buddy: CLI) {
1315
.option('--verbose', descriptions.verbose, { default: false })
1416
.option('--debug', descriptions.debug, { default: false })
1517
.action(async (options: FreshOptions) => {
16-
await migrations()
18+
const perf = await intro('buddy migrate')
19+
const result = await runAction(Action.Migrate, { ...options, showSpinner: true, spinnerText: 'Freshly installing dependencies...' })
20+
21+
if (result.isErr()) {
22+
outro('While running the migrate command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error)
23+
process.exit()
24+
}
25+
26+
const APP_ENV = process.env.APP_ENV || 'local'
27+
28+
outro(`Migrated your ${APP_ENV} database.`, { startTime: perf, useSeconds: true })
29+
process.exit(ExitCode.Success)
1730
})
1831
}
1932

0 commit comments

Comments
 (0)