-
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.
Browse files
Browse the repository at this point in the history
* renames some collections: user_login_migrations -> user-login-migrations external_tools -> external-tools context_external_tools -> context-external-tools school_external_tools -> school-external-tools
- Loading branch information
Showing
13 changed files
with
69 additions
and
13 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
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
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
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 @@ | ||
[] |
44 changes: 44 additions & 0 deletions
44
migrations/1699529266062-tool-and-user-login-migration-renamings.js
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,44 @@ | ||
const mongoose = require('mongoose'); | ||
const { info, error } = require('../src/logger'); | ||
|
||
const { connect, close } = require('../src/utils/database'); | ||
|
||
async function renameCollection(oldName, newName) { | ||
try { | ||
await mongoose.connection.collection(oldName).rename(newName); | ||
info(`Renamed collection ${oldName} to ${newName}`); | ||
} catch (err) { | ||
error(`Error renaming collection ${oldName} to ${newName}: ${err.message}`); | ||
throw err; | ||
} | ||
} | ||
|
||
module.exports = { | ||
up: async function up() { | ||
await connect(); | ||
|
||
await renameCollection('user_login_migrations', 'user-login-migrations'); | ||
|
||
await renameCollection('external_tools', 'external-tools'); | ||
|
||
await renameCollection('context_external_tools', 'context-external-tools'); | ||
|
||
await renameCollection('school_external_tools', 'school-external-tools'); | ||
|
||
await close(); | ||
}, | ||
|
||
down: async function down() { | ||
await connect(); | ||
|
||
await renameCollection('user-login-migrations', 'user_login_migrations'); | ||
|
||
await renameCollection('external-tools', 'external_tools'); | ||
|
||
await renameCollection('context-external-tools', 'context_external_tools'); | ||
|
||
await renameCollection('school-external-tools', 'school_external_tools'); | ||
|
||
await close(); | ||
}, | ||
}; |
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