-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13fb396
commit 32913cf
Showing
3 changed files
with
20 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import process from 'node:process' | ||
import { resetDatabase } from '@stacksjs/database' | ||
import { generateMigrations, resetDatabase, runDatabaseMigration } from '@stacksjs/database' | ||
import { log } from '@stacksjs/logging' | ||
|
||
// this is run and checks whether new created or update migrations need to be generated | ||
// first, reset the database, if it exists | ||
const result = await resetDatabase() | ||
|
||
if (result?.isErr()) { | ||
console.error(result.error) | ||
log.error('[stacks] generateMigrations failed', result.error) | ||
log.error('generateMigrations failed', result.error) | ||
process.exit(1) | ||
} | ||
|
||
// then,generate the migrations | ||
await generateMigrations() | ||
|
||
// finally, migrate the database | ||
await runDatabaseMigration() | ||
|
||
process.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters