Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add type annotations in sample migrations #446

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,23 @@ Created: migrations/20160608155948-blacklist_the_beatles.js
A new migration file is created in the 'migrations' directory:
````javascript
module.exports = {
/**
* @param db {import('mongodb').Db}
* @param client {import('mongodb').MongoClient}
* @returns {Promise<void>}
*/
up(db, client) {
// TODO write your migration here. Return a Promise (and/or use async & await).
// See https://github.com/seppevs/migrate-mongo/#creating-a-new-migration-script
// Example:
// return db.collection('albums').updateOne({artist: 'The Beatles'}, {$set: {blacklisted: true}});
},

/**
* @param db {import('mongodb').Db}
* @param client {import('mongodb').MongoClient}
* @returns {Promise<void>}
*/
down(db, client) {
// TODO write the statements to rollback your migration (if possible)
// Example:
Expand Down
10 changes: 10 additions & 0 deletions samples/commonjs/migration.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
module.exports = {
/**
* @param db {import('mongodb').Db}
* @param client {import('mongodb').MongoClient}
* @returns {Promise<void>}
*/
async up(db, client) {
// TODO write your migration here.
// See https://github.com/seppevs/migrate-mongo/#creating-a-new-migration-script
// Example:
// await db.collection('albums').updateOne({artist: 'The Beatles'}, {$set: {blacklisted: true}});
},

/**
* @param db {import('mongodb').Db}
* @param client {import('mongodb').MongoClient}
* @returns {Promise<void>}
*/
async down(db, client) {
// TODO write the statements to rollback your migration (if possible)
// Example:
Expand Down
10 changes: 10 additions & 0 deletions samples/esm/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/**
* @param db {import('mongodb').Db}
* @param client {import('mongodb').MongoClient}
* @returns {Promise<void>}
*/
export const up = async (db, client) => {
// TODO write your migration here.
// See https://github.com/seppevs/migrate-mongo/#creating-a-new-migration-script
// Example:
// await db.collection('albums').updateOne({artist: 'The Beatles'}, {$set: {blacklisted: true}});
};

/**
* @param db {import('mongodb').Db}
* @param client {import('mongodb').MongoClient}
* @returns {Promise<void>}
*/
export const down = async (db, client) => {
// TODO write the statements to rollback your migration (if possible)
// Example:
Expand Down