-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: remove unused history snapshots and make it in-mem only
- Loading branch information
Showing
10 changed files
with
61 additions
and
205 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
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
import fs from 'fs-extra'; | ||
import path from 'path'; | ||
|
||
import config from '../../../config'; | ||
import Users from '../../models/Users'; | ||
|
||
const migration = () => { | ||
return Users.listUsers().then((users) => { | ||
return Promise.all( | ||
users.map((user) => fs.rm(path.join(config.dbPath, user._id, 'history'), {recursive: true})), | ||
).catch(() => { | ||
// do nothing. | ||
}); | ||
}); | ||
}; | ||
|
||
export default migration; |
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,8 +1,13 @@ | ||
import UserInDatabase2 from './UserInDatabase2'; | ||
import UserInDatabase3 from './UserInDatabase3'; | ||
import UserInDatabase2 from './00-UserInDatabase2'; | ||
import UserInDatabase3 from './01-UserInDatabase3'; | ||
import HistoryEra from './02-HistoryEra'; | ||
|
||
const migrations = [UserInDatabase2, UserInDatabase3]; | ||
const migrations = [UserInDatabase2, UserInDatabase3, HistoryEra]; | ||
|
||
const migrate = () => Promise.all(migrations.map((migration) => migration())); | ||
const migrate = async () => { | ||
for await (const migrate of migrations) { | ||
await migrate(); | ||
} | ||
}; | ||
|
||
export default migrate; |
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
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
Oops, something went wrong.