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

New Version #20

Merged
merged 17 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.config.json"
"test:e2e": "jest --config ./test/jest-e2e.config.json",
"cleanup-lockfile": "yarn-deduplicate --strategy fewer"
},
"dependencies": {
"@types/mongoose": "^5.0.0",
"@types/mongodb": "^3.0.0"
},
"husky": {
Expand All @@ -47,32 +47,33 @@
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/github": "^7.0.5",
"@semantic-release/npm": "^7.0.5",
"@semantic-release/github": "^7.2.0",
"@semantic-release/npm": "^7.0.10",
"@semantic-release/release-notes-generator": "^9.0.1",
"@types/jest": "^25.2.1",
"@types/node": "^12.12.34",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"@types/jest": "^26.0.20",
"@types/node": "^12.19.14",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"condition-circle": "^2.0.2",
"dependency-check": "^4.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"jest": "^25.2.7",
"jest-circus": "^25.2.7",
"jest-html-reporter": "^3.0.0",
"jest-junit": "^10.0.0",
"prettier": "^2.0.4",
"pretty-quick": "^2.0.1",
"eslint": "^7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.3.8",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-html-reporter": "^3.3.0",
"jest-junit": "^12.0.0",
"mongoose": "5.11.12",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.4",
"ts-jest": "^25.3.1",
"typescript": "~3.8.3"
"semantic-release": "^17.3.4",
"ts-jest": "^26.4.4",
"typescript": "~4.1.3",
"yarn-deduplicate": "^3.1.0"
},
"peerDependencies": {
"mongoose": "^5.0.0",
"mongodb": "^3.0.0"
"mongoose": "^5.11.12"
}
}
4 changes: 2 additions & 2 deletions src/abstract-migrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export abstract class AbstractMigrator {
return this.versionStorage.writeVersion(version);
}

protected abstract async upgrade(fromVersion: number | null, toVersion: number): Promise<void>;
protected abstract upgrade(fromVersion: number | null, toVersion: number): Promise<void>;

protected abstract async downgrade(fromVersion: number, toVersion: number): Promise<void>;
protected abstract downgrade(fromVersion: number, toVersion: number): Promise<void>;
}
2 changes: 1 addition & 1 deletion src/mongodb-collection-migrator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Collection, Db } from 'mongodb';
import type { Collection, Db } from 'mongodb';

import { AbstractMigrator } from './abstract-migrator';
import { MongodbCollectionVersionStorage } from './mongodb-collection-version-storage';
Expand Down
4 changes: 2 additions & 2 deletions src/mongodb-collection-version-storage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Collection } from 'mongodb';
import type { Collection } from 'mongodb';

import { VersionStorage, VersionInformation } from './abstract-migrator';
import type { VersionStorage, VersionInformation } from './abstract-migrator';

export class MongodbCollectionVersionStorage implements VersionStorage {
constructor(private readonly versionCollection: Collection<VersionInformation>) {}
Expand Down
7 changes: 4 additions & 3 deletions src/mongodb-collection-versioning-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Db } from 'mongodb';
import type { Db } from 'mongodb';

import { VersionInformation } from './abstract-migrator';
import { CollectionMigrationHandler, CollectionMigrator } from './mongodb-collection-migrator';
import type { VersionInformation } from './abstract-migrator';
import type { CollectionMigrationHandler } from './mongodb-collection-migrator';
import { CollectionMigrator } from './mongodb-collection-migrator';
import { MongodbCollectionVersionStorage } from './mongodb-collection-version-storage';
import { getGlobalMongooseConnectionDb } from './utils';

Expand Down
4 changes: 2 additions & 2 deletions src/mongoose-model-migrator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document, Model } from 'mongoose';
import { Db } from 'mongodb';
import type { Document, Model } from 'mongoose';
import type { Db } from 'mongodb';

import { AbstractMigrator } from './abstract-migrator';
import { MongodbCollectionVersionStorage } from './mongodb-collection-version-storage';
Expand Down
9 changes: 5 additions & 4 deletions src/mongoose-model-versioning-utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Document, Model } from 'mongoose';
import { Db } from 'mongodb';
import type { Document, Model } from 'mongoose';
import type { Db } from 'mongodb';

import { ModelMigrationHandler, ModelMigrator } from './mongoose-model-migrator';
import type { ModelMigrationHandler } from './mongoose-model-migrator';
import { ModelMigrator } from './mongoose-model-migrator';
import { getGlobalMongooseConnectionDb } from './utils';
import { VersionInformation } from './abstract-migrator';
import type { VersionInformation } from './abstract-migrator';
import { MongodbCollectionVersionStorage } from './mongodb-collection-version-storage';

export interface ModelMigratorOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Db } from 'mongodb';
import type { Db } from 'mongodb';

export async function getGlobalMongooseConnectionDb(): Promise<Db> {
const mongoose = await import('mongoose');
Expand Down
Loading