-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for console mikroorm config findOneOrFailHandler
- Loading branch information
1 parent
efe9073
commit 4668d0d
Showing
5 changed files
with
41 additions
and
7 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
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
16 changes: 16 additions & 0 deletions
16
apps/server/src/migrations/mikro-orm/Migration20240108145519.ts
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Migration } from '@mikro-orm/migrations-mongodb'; | ||
|
||
/* | ||
* cleanup old migration records from db | ||
*/ | ||
export class Migration20240108111130 extends Migration { | ||
async up(): Promise<void> { | ||
const { deletedCount } = await this.getCollection('migrations').deleteMany({}, { session: this.ctx }); | ||
console.log(`removed ${deletedCount} records`); | ||
} | ||
|
||
async down(): Promise<void> { | ||
// do nothing | ||
console.error(`Migration down not implemented. You might need to restore database from backup!`); | ||
} | ||
} |
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