@mikro-orm/migrations-mongodb 7.0.0-dev.33 → 7.0.0-dev.330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,12 +10,12 @@ export class JSMigrationGenerator extends MigrationGenerator {
10
10
  ret += `class ${className} extends Migration {\n\n`;
11
11
  ret += ` async up() {\n`;
12
12
  /* v8 ignore next */
13
- diff.up.forEach(sql => ret += this.createStatement(sql, 4));
13
+ diff.up.forEach(sql => (ret += this.createStatement(sql, 4)));
14
14
  ret += ` }\n\n`;
15
- /* v8 ignore next 5 */
15
+ /* v8 ignore next */
16
16
  if (diff.down.length > 0) {
17
17
  ret += ` async down() {\n`;
18
- diff.down.forEach(sql => ret += this.createStatement(sql, 4));
18
+ diff.down.forEach(sql => (ret += this.createStatement(sql, 4)));
19
19
  ret += ` }\n\n`;
20
20
  }
21
21
  ret += `}\n`;
package/Migration.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Configuration, Transaction, EntityName } from '@mikro-orm/core';
2
2
  import type { MongoDriver } from '@mikro-orm/mongodb';
3
- import type { Collection, ClientSession, Document } from 'mongodb';
3
+ import type { Collection, ClientSession, Document, Db } from 'mongodb';
4
4
  export declare abstract class Migration {
5
5
  protected readonly driver: MongoDriver;
6
6
  protected readonly config: Configuration;
@@ -11,5 +11,6 @@ export declare abstract class Migration {
11
11
  isTransactional(): boolean;
12
12
  reset(): void;
13
13
  setTransactionContext(ctx: Transaction): void;
14
- getCollection<T extends Document>(entityName: EntityName<any>): Collection<T>;
14
+ getCollection<T extends Document>(entityOrCollectionName: EntityName<T> | string): Collection<T>;
15
+ getDb(): Db;
15
16
  }
package/Migration.js CHANGED
@@ -18,7 +18,10 @@ export class Migration {
18
18
  setTransactionContext(ctx) {
19
19
  this.ctx = ctx;
20
20
  }
21
- getCollection(entityName) {
22
- return this.driver.getConnection().getCollection(entityName);
21
+ getCollection(entityOrCollectionName) {
22
+ return this.driver.getConnection().getCollection(entityOrCollectionName);
23
+ }
24
+ getDb() {
25
+ return this.driver.getConnection().getDb();
23
26
  }
24
27
  }
@@ -12,9 +12,7 @@ export declare abstract class MigrationGenerator implements IMigrationGenerator
12
12
  up: string[];
13
13
  down: string[];
14
14
  }, path?: string, name?: string): Promise<[string, string]>;
15
- /**
16
- * @inheritDoc
17
- */
15
+ /** @inheritDoc */
18
16
  createStatement(query: string, padLeft: number): string;
19
17
  /**
20
18
  * @inheritDoc
@@ -1,5 +1,3 @@
1
- import { Utils, } from '@mikro-orm/core';
2
- import { writeFile } from 'node:fs/promises';
3
1
  export class MigrationGenerator {
4
2
  driver;
5
3
  namingStrategy;
@@ -13,21 +11,20 @@ export class MigrationGenerator {
13
11
  * @inheritDoc
14
12
  */
15
13
  async generate(diff, path, name) {
14
+ const { fs } = await import('@mikro-orm/core/fs-utils');
16
15
  /* v8 ignore next */
17
16
  const defaultPath = this.options.emit === 'ts' && this.options.pathTs ? this.options.pathTs : this.options.path;
18
- path = Utils.normalizePath(this.driver.config.get('baseDir'), path ?? defaultPath);
19
- Utils.ensureDir(path);
20
- const timestamp = new Date().toISOString().replace(/[-T:]|\.\d{3}z$/ig, '');
17
+ path = fs.normalizePath(this.driver.config.get('baseDir'), path ?? defaultPath);
18
+ fs.ensureDir(path);
19
+ const timestamp = new Date().toISOString().replace(/[-T:]|\.\d{3}z$/gi, '');
21
20
  const className = this.namingStrategy.classToMigrationName(timestamp, name);
22
21
  const fileName = `${this.options.fileName(timestamp, name)}.${this.options.emit}`;
23
22
  const ret = await this.generateMigrationFile(className, diff);
24
- await writeFile(path + '/' + fileName, ret, { flush: true });
23
+ await fs.writeFile(path + '/' + fileName, ret, { flush: true });
25
24
  return [ret, fileName];
26
25
  }
27
- /* v8 ignore start */
28
- /**
29
- * @inheritDoc
30
- */
26
+ /** @inheritDoc */
27
+ /* v8 ignore next */
31
28
  createStatement(query, padLeft) {
32
29
  if (query) {
33
30
  const padding = ' '.repeat(padLeft);
@@ -1,15 +1,18 @@
1
- import type { MigrationsOptions, Transaction } from '@mikro-orm/core';
1
+ import { type EntitySchema, type MigrationsOptions, type Transaction } from '@mikro-orm/core';
2
2
  import type { MongoDriver } from '@mikro-orm/mongodb';
3
- import type { MigrationParams, UmzugStorage } from 'umzug';
4
3
  import type { MigrationRow } from './typings.js';
5
- export declare class MigrationStorage implements UmzugStorage {
4
+ export declare class MigrationStorage {
6
5
  protected readonly driver: MongoDriver;
7
6
  protected readonly options: MigrationsOptions;
8
7
  private masterTransaction?;
9
8
  constructor(driver: MongoDriver, options: MigrationsOptions);
10
9
  executed(): Promise<string[]>;
11
- logMigration(params: MigrationParams<any>): Promise<void>;
12
- unlogMigration(params: MigrationParams<any>): Promise<void>;
10
+ logMigration(params: {
11
+ name: string;
12
+ }): Promise<void>;
13
+ unlogMigration(params: {
14
+ name: string;
15
+ }): Promise<void>;
13
16
  getExecutedMigrations(): Promise<MigrationRow[]>;
14
17
  setMasterMigration(trx: Transaction): void;
15
18
  unsetMasterMigration(): void;
@@ -17,4 +20,8 @@ export declare class MigrationStorage implements UmzugStorage {
17
20
  * @internal
18
21
  */
19
22
  getMigrationName(name: string): string;
23
+ /**
24
+ * @internal
25
+ */
26
+ getEntityDefinition(): EntitySchema;
20
27
  }
@@ -1,4 +1,4 @@
1
- import * as path from 'node:path';
1
+ import { defineEntity, p, } from '@mikro-orm/core';
2
2
  export class MigrationStorage {
3
3
  driver;
4
4
  options;
@@ -9,21 +9,21 @@ export class MigrationStorage {
9
9
  }
10
10
  async executed() {
11
11
  const migrations = await this.getExecutedMigrations();
12
- return migrations.map(({ name }) => `${this.getMigrationName(name)}`);
12
+ return migrations.map(({ name }) => this.getMigrationName(name));
13
13
  }
14
14
  async logMigration(params) {
15
- const tableName = this.options.tableName;
16
15
  const name = this.getMigrationName(params.name);
17
- await this.driver.nativeInsert(tableName, { name, executed_at: new Date() }, { ctx: this.masterTransaction });
16
+ const entity = this.getEntityDefinition();
17
+ await this.driver.nativeInsert(entity, { name, executed_at: new Date() }, { ctx: this.masterTransaction });
18
18
  }
19
19
  async unlogMigration(params) {
20
- const tableName = this.options.tableName;
21
20
  const withoutExt = this.getMigrationName(params.name);
22
- await this.driver.nativeDelete(tableName, { name: { $in: [params.name, withoutExt] } }, { ctx: this.masterTransaction });
21
+ const entity = this.getEntityDefinition();
22
+ await this.driver.nativeDelete(entity, { name: { $in: [params.name, withoutExt] } }, { ctx: this.masterTransaction });
23
23
  }
24
24
  async getExecutedMigrations() {
25
- const tableName = this.options.tableName;
26
- return this.driver.find(tableName, {}, { ctx: this.masterTransaction, orderBy: { _id: 'asc' } });
25
+ const entity = this.getEntityDefinition();
26
+ return this.driver.find(entity, {}, { ctx: this.masterTransaction, orderBy: { _id: 'asc' } });
27
27
  }
28
28
  setMasterMigration(trx) {
29
29
  this.masterTransaction = trx;
@@ -35,11 +35,22 @@ export class MigrationStorage {
35
35
  * @internal
36
36
  */
37
37
  getMigrationName(name) {
38
- const parsedName = path.parse(name);
39
- if (['.js', '.ts'].includes(parsedName.ext)) {
40
- // strip extension
41
- return parsedName.name;
42
- }
43
- return name;
38
+ return name.replace(/\.[jt]s$/, '');
39
+ }
40
+ /**
41
+ * @internal
42
+ */
43
+ getEntityDefinition() {
44
+ const entity = defineEntity({
45
+ name: 'Migration',
46
+ tableName: this.options.tableName,
47
+ properties: {
48
+ id: p.integer().primary().fieldNames('id'),
49
+ name: p.string().fieldNames('name'),
50
+ executedAt: p.datetime().defaultRaw('current_timestamp').fieldNames('executed_at'),
51
+ },
52
+ }).init();
53
+ entity.meta.sync();
54
+ return entity;
44
55
  }
45
56
  }
package/Migrator.d.ts CHANGED
@@ -1,64 +1,22 @@
1
- import { type MigrationParams, type RunnableMigration } from 'umzug';
2
- import { type Constructor, type IMigrator, type MikroORM, type MigratorEvent, type MaybePromise } from '@mikro-orm/core';
3
- import type { EntityManager } from '@mikro-orm/mongodb';
4
- import type { Migration } from './Migration.js';
1
+ import { type IMigrationGenerator, type IMigrationRunner, type IMigratorStorage, type MikroORM } from '@mikro-orm/core';
2
+ import { AbstractMigrator } from '@mikro-orm/core/migrations';
3
+ import type { MongoDriver } from '@mikro-orm/mongodb';
5
4
  import { MigrationStorage } from './MigrationStorage.js';
6
- import type { MigrateOptions, MigrationResult, MigrationRow, UmzugMigration } from './typings.js';
7
- export declare class Migrator implements IMigrator {
8
- private readonly em;
9
- private umzug;
10
- private runner;
11
- private storage;
12
- private generator;
13
- private readonly driver;
14
- private readonly config;
15
- private readonly options;
16
- private readonly absolutePath;
17
- constructor(em: EntityManager);
5
+ import type { MigrationResult } from './typings.js';
6
+ export declare class Migrator extends AbstractMigrator<MongoDriver> {
18
7
  static register(orm: MikroORM): void;
8
+ protected createRunner(): IMigrationRunner;
9
+ protected createStorage(): IMigratorStorage;
10
+ protected getDefaultGenerator(): IMigrationGenerator;
19
11
  /**
20
12
  * @inheritDoc
21
13
  */
22
- createMigration(path?: string, blank?: boolean, initial?: boolean, name?: string): Promise<MigrationResult>;
14
+ create(path?: string, blank?: boolean, initial?: boolean, name?: string): Promise<MigrationResult>;
15
+ /** @inheritDoc */
16
+ checkSchema(): Promise<boolean>;
23
17
  /**
24
18
  * @inheritDoc
25
19
  */
26
- checkMigrationNeeded(): Promise<boolean>;
27
- /**
28
- * @inheritDoc
29
- */
30
- createInitialMigration(path?: string): Promise<MigrationResult>;
31
- /**
32
- * @inheritDoc
33
- */
34
- on(eventName: MigratorEvent, listener: (event: UmzugMigration) => MaybePromise<void>): this;
35
- /**
36
- * @inheritDoc
37
- */
38
- off(eventName: MigratorEvent, listener: (event: UmzugMigration) => MaybePromise<void>): this;
39
- private createUmzug;
40
- /**
41
- * @inheritDoc
42
- */
43
- getExecutedMigrations(): Promise<MigrationRow[]>;
44
- /**
45
- * @inheritDoc
46
- */
47
- getPendingMigrations(): Promise<UmzugMigration[]>;
48
- /**
49
- * @inheritDoc
50
- */
51
- up(options?: string | string[] | MigrateOptions): Promise<UmzugMigration[]>;
52
- /**
53
- * @inheritDoc
54
- */
55
- down(options?: string | string[] | MigrateOptions): Promise<UmzugMigration[]>;
20
+ createInitial(path?: string): Promise<MigrationResult>;
56
21
  getStorage(): MigrationStorage;
57
- protected resolve(params: MigrationParams<any>): RunnableMigration<any>;
58
- protected initialize(MigrationClass: Constructor<Migration>, name: string): RunnableMigration<any>;
59
- private getMigrationFilename;
60
- private prefix;
61
- private runMigrations;
62
- private runInTransaction;
63
- private ensureMigrationsDirExists;
64
22
  }
package/Migrator.js CHANGED
@@ -1,38 +1,30 @@
1
- import { Umzug } from 'umzug';
2
- import { join } from 'node:path';
3
- import { Utils, } from '@mikro-orm/core';
1
+ import { AbstractMigrator } from '@mikro-orm/core/migrations';
4
2
  import { MigrationRunner } from './MigrationRunner.js';
5
3
  import { MigrationStorage } from './MigrationStorage.js';
6
4
  import { TSMigrationGenerator } from './TSMigrationGenerator.js';
7
5
  import { JSMigrationGenerator } from './JSMigrationGenerator.js';
8
- export class Migrator {
9
- em;
10
- umzug;
11
- runner;
12
- storage;
13
- generator;
14
- driver;
15
- config;
16
- options;
17
- absolutePath;
18
- constructor(em) {
19
- this.em = em;
20
- this.driver = this.em.getDriver();
21
- this.config = this.em.config;
22
- this.options = this.config.get('migrations');
23
- /* v8 ignore next */
24
- const key = (this.config.get('preferTs', Utils.detectTypeScriptSupport()) && this.options.pathTs) ? 'pathTs' : 'path';
25
- this.absolutePath = Utils.absolutePath(this.options[key], this.config.get('baseDir'));
26
- this.createUmzug();
27
- }
6
+ export class Migrator extends AbstractMigrator {
28
7
  static register(orm) {
29
8
  orm.config.registerExtension('@mikro-orm/migrator', () => new Migrator(orm.em));
30
9
  }
10
+ createRunner() {
11
+ return new MigrationRunner(this.driver, this.options);
12
+ }
13
+ createStorage() {
14
+ return new MigrationStorage(this.driver, this.options);
15
+ }
16
+ getDefaultGenerator() {
17
+ /* v8 ignore next */
18
+ if (this.options.emit === 'js' || this.options.emit === 'cjs') {
19
+ return new JSMigrationGenerator(this.driver, this.config.getNamingStrategy(), this.options);
20
+ }
21
+ return new TSMigrationGenerator(this.driver, this.config.getNamingStrategy(), this.options);
22
+ }
31
23
  /**
32
24
  * @inheritDoc
33
25
  */
34
- async createMigration(path, blank = false, initial = false, name) {
35
- this.ensureMigrationsDirExists();
26
+ async create(path, blank = false, initial = false, name) {
27
+ await this.init();
36
28
  const diff = { up: [], down: [] };
37
29
  const migration = await this.generator.generate(diff, path, name);
38
30
  return {
@@ -41,165 +33,18 @@ export class Migrator {
41
33
  diff,
42
34
  };
43
35
  }
44
- /* v8 ignore start */
45
- /**
46
- * @inheritDoc
47
- */
48
- async checkMigrationNeeded() {
36
+ /** @inheritDoc */
37
+ /* v8 ignore next */
38
+ async checkSchema() {
49
39
  return true;
50
40
  }
51
- /* v8 ignore stop */
52
- /**
53
- * @inheritDoc
54
- */
55
- async createInitialMigration(path) {
56
- return this.createMigration(path);
57
- }
58
- /**
59
- * @inheritDoc
60
- */
61
- on(eventName, listener) {
62
- this.umzug.on(eventName, listener);
63
- return this;
64
- }
65
- /**
66
- * @inheritDoc
67
- */
68
- off(eventName, listener) {
69
- this.umzug.off(eventName, listener);
70
- return this;
71
- }
72
- createUmzug() {
73
- this.runner = new MigrationRunner(this.driver, this.options);
74
- this.storage = new MigrationStorage(this.driver, this.options);
75
- let migrations = {
76
- glob: join(this.absolutePath, this.options.glob).replace(/\\/g, '/'),
77
- resolve: (params) => this.resolve(params),
78
- };
79
- /* v8 ignore next 8 */
80
- if (this.options.migrationsList) {
81
- migrations = this.options.migrationsList.map(migration => {
82
- if (typeof migration === 'function') {
83
- return this.initialize(migration, migration.name);
84
- }
85
- return this.initialize(migration.class, migration.name);
86
- });
87
- }
88
- this.umzug = new Umzug({
89
- storage: this.storage,
90
- logger: undefined,
91
- migrations,
92
- });
93
- if (!this.options.silent) {
94
- const logger = this.config.getLogger();
95
- this.umzug.on('migrating', event => logger.log('migrator', `Processing '${event.name}'`, { enabled: true }));
96
- this.umzug.on('migrated', event => logger.log('migrator', `Applied '${event.name}'`, { enabled: true }));
97
- this.umzug.on('reverting', event => logger.log('migrator', `Processing '${event.name}'`, { enabled: true }));
98
- this.umzug.on('reverted', event => logger.log('migrator', `Reverted '${event.name}'`, { enabled: true }));
99
- }
100
- /* v8 ignore next 3 */
101
- if (this.options.generator) {
102
- this.generator = new this.options.generator(this.driver, this.config.getNamingStrategy(), this.options);
103
- }
104
- else if (this.options.emit === 'js' || this.options.emit === 'cjs') {
105
- this.generator = new JSMigrationGenerator(this.driver, this.config.getNamingStrategy(), this.options);
106
- }
107
- else {
108
- this.generator = new TSMigrationGenerator(this.driver, this.config.getNamingStrategy(), this.options);
109
- }
110
- }
111
- /**
112
- * @inheritDoc
113
- */
114
- async getExecutedMigrations() {
115
- this.ensureMigrationsDirExists();
116
- return this.storage.getExecutedMigrations();
117
- }
118
- /**
119
- * @inheritDoc
120
- */
121
- async getPendingMigrations() {
122
- this.ensureMigrationsDirExists();
123
- return this.umzug.pending();
124
- }
125
41
  /**
126
42
  * @inheritDoc
127
43
  */
128
- async up(options) {
129
- return this.runMigrations('up', options);
130
- }
131
- /**
132
- * @inheritDoc
133
- */
134
- async down(options) {
135
- return this.runMigrations('down', options);
44
+ async createInitial(path) {
45
+ return this.create(path);
136
46
  }
137
47
  getStorage() {
138
48
  return this.storage;
139
49
  }
140
- resolve(params) {
141
- const createMigrationHandler = async (method) => {
142
- const migration = await Utils.dynamicImport(params.path);
143
- const MigrationClass = Object.values(migration).find(cls => typeof cls === 'function' && typeof cls.constructor === 'function');
144
- const instance = new MigrationClass(this.driver, this.config);
145
- await this.runner.run(instance, method);
146
- };
147
- return {
148
- name: this.storage.getMigrationName(params.name),
149
- up: () => createMigrationHandler('up'),
150
- down: () => createMigrationHandler('down'),
151
- };
152
- }
153
- initialize(MigrationClass, name) {
154
- const instance = new MigrationClass(this.driver, this.config);
155
- return {
156
- name: this.storage.getMigrationName(name),
157
- up: () => this.runner.run(instance, 'up'),
158
- /* v8 ignore next */
159
- down: () => this.runner.run(instance, 'down'),
160
- };
161
- }
162
- getMigrationFilename(name) {
163
- name = name.replace(/\.[jt]s$/, '');
164
- return name.match(/^\d{14}$/) ? this.options.fileName(name) : name;
165
- }
166
- prefix(options) {
167
- if (Utils.isString(options) || Array.isArray(options)) {
168
- return { migrations: Utils.asArray(options).map(name => this.getMigrationFilename(name)) };
169
- }
170
- if (!options) {
171
- return {};
172
- }
173
- if (options.migrations) {
174
- options.migrations = options.migrations.map(name => this.getMigrationFilename(name));
175
- }
176
- if (options.transaction) {
177
- delete options.transaction;
178
- }
179
- ['from', 'to'].filter(k => options[k]).forEach(k => options[k] = this.getMigrationFilename(options[k]));
180
- return options;
181
- }
182
- async runMigrations(method, options) {
183
- this.ensureMigrationsDirExists();
184
- if (!this.options.transactional || !this.options.allOrNothing) {
185
- return this.umzug[method](this.prefix(options));
186
- }
187
- if (Utils.isObject(options) && options.transaction) {
188
- return this.runInTransaction(options.transaction, method, options);
189
- }
190
- return this.driver.getConnection().transactional(trx => this.runInTransaction(trx, method, options));
191
- }
192
- async runInTransaction(trx, method, options) {
193
- this.runner.setMasterMigration(trx);
194
- this.storage.setMasterMigration(trx);
195
- const ret = await this.umzug[method](this.prefix(options));
196
- this.runner.unsetMasterMigration();
197
- this.storage.unsetMasterMigration();
198
- return ret;
199
- }
200
- ensureMigrationsDirExists() {
201
- if (!this.options.migrationsList) {
202
- Utils.ensureDir(this.absolutePath);
203
- }
204
- }
205
50
  }
package/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
  <a href="https://mikro-orm.io"><img src="https://raw.githubusercontent.com/mikro-orm/mikro-orm/master/docs/static/img/logo-readme.svg?sanitize=true" alt="MikroORM" /></a>
3
3
  </h1>
4
4
 
5
- TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite (including libSQL) databases.
5
+ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL, SQLite (including libSQL), MSSQL and Oracle databases.
6
6
 
7
7
  > Heavily inspired by [Doctrine](https://www.doctrine-project.org/) and [Hibernate](https://hibernate.org/).
8
8
 
9
- [![NPM version](https://img.shields.io/npm/v/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
10
- [![NPM dev version](https://img.shields.io/npm/v/@mikro-orm/core/next.svg)](https://www.npmjs.com/package/@mikro-orm/core)
9
+ [![NPM version](https://img.shields.io/npm/v/@mikro-orm/core.svg)](https://npmx.dev/package/@mikro-orm/core)
10
+ [![NPM dev version](https://img.shields.io/npm/v/@mikro-orm/core/next.svg)](https://npmx.dev/package/@mikro-orm/core)
11
11
  [![Chat on discord](https://img.shields.io/discord/1214904142443839538?label=discord&color=blue)](https://discord.gg/w8bjxFHS7X)
12
- [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
12
+ [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://npmx.dev/package/@mikro-orm/core)
13
13
  [![Coverage Status](https://img.shields.io/coveralls/mikro-orm/mikro-orm.svg)](https://coveralls.io/r/mikro-orm/mikro-orm?branch=master)
14
14
  [![Build Status](https://github.com/mikro-orm/mikro-orm/workflows/tests/badge.svg?branch=master)](https://github.com/mikro-orm/mikro-orm/actions?workflow=tests)
15
15
 
@@ -181,6 +181,7 @@ yarn add @mikro-orm/core @mikro-orm/mysql # for mysql/mariadb
181
181
  yarn add @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
182
182
  yarn add @mikro-orm/core @mikro-orm/postgresql # for postgresql
183
183
  yarn add @mikro-orm/core @mikro-orm/mssql # for mssql
184
+ yarn add @mikro-orm/core @mikro-orm/oracledb # for oracle
184
185
  yarn add @mikro-orm/core @mikro-orm/sqlite # for sqlite
185
186
  yarn add @mikro-orm/core @mikro-orm/libsql # for libsql
186
187
  ```
@@ -381,6 +382,8 @@ See also the list of contributors who [participated](https://github.com/mikro-or
381
382
 
382
383
  Please ⭐️ this repository if this project helped you!
383
384
 
385
+ > If you'd like to support my open-source work, consider sponsoring me directly at [github.com/sponsors/b4nan](https://github.com/sponsors/b4nan).
386
+
384
387
  ## 📝 License
385
388
 
386
389
  Copyright © 2018 [Martin Adámek](https://github.com/b4nan).
@@ -8,12 +8,12 @@ export class TSMigrationGenerator extends MigrationGenerator {
8
8
  ret += `export class ${className} extends Migration {\n\n`;
9
9
  ret += ` async up(): Promise<void> {\n`;
10
10
  /* v8 ignore next */
11
- diff.up.forEach(sql => ret += this.createStatement(sql, 4));
11
+ diff.up.forEach(sql => (ret += this.createStatement(sql, 4)));
12
12
  ret += ` }\n\n`;
13
- /* v8 ignore next 5 */
13
+ /* v8 ignore next */
14
14
  if (diff.down.length > 0) {
15
15
  ret += ` async down(): Promise<void> {\n`;
16
- diff.down.forEach(sql => ret += this.createStatement(sql, 4));
16
+ diff.down.forEach(sql => (ret += this.createStatement(sql, 4)));
17
17
  ret += ` }\n\n`;
18
18
  }
19
19
  ret += `}\n`;
package/index.d.ts CHANGED
@@ -9,4 +9,4 @@ export * from './MigrationGenerator.js';
9
9
  export * from './JSMigrationGenerator.js';
10
10
  export * from './TSMigrationGenerator.js';
11
11
  export * from './MigrationStorage.js';
12
- export * from './typings.js';
12
+ export type * from './typings.js';
package/index.js CHANGED
@@ -9,4 +9,3 @@ export * from './MigrationGenerator.js';
9
9
  export * from './JSMigrationGenerator.js';
10
10
  export * from './TSMigrationGenerator.js';
11
11
  export * from './MigrationStorage.js';
12
- export * from './typings.js';
package/package.json CHANGED
@@ -1,63 +1,62 @@
1
1
  {
2
2
  "name": "@mikro-orm/migrations-mongodb",
3
- "type": "module",
4
- "version": "7.0.0-dev.33",
3
+ "version": "7.0.0-dev.330",
5
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
6
- "exports": {
7
- "./package.json": "./package.json",
8
- ".": "./index.js"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
13
- },
14
5
  "keywords": [
15
- "orm",
6
+ "data-mapper",
7
+ "ddd",
8
+ "entity",
9
+ "identity-map",
10
+ "javascript",
11
+ "js",
12
+ "mariadb",
13
+ "mikro-orm",
16
14
  "mongo",
17
15
  "mongodb",
18
16
  "mysql",
19
- "mariadb",
17
+ "orm",
20
18
  "postgresql",
21
19
  "sqlite",
22
20
  "sqlite3",
23
21
  "ts",
24
22
  "typescript",
25
- "js",
26
- "javascript",
27
- "entity",
28
- "ddd",
29
- "mikro-orm",
30
- "unit-of-work",
31
- "data-mapper",
32
- "identity-map"
23
+ "unit-of-work"
33
24
  ],
34
- "author": "Martin Adámek",
35
- "license": "MIT",
25
+ "homepage": "https://mikro-orm.io",
36
26
  "bugs": {
37
27
  "url": "https://github.com/mikro-orm/mikro-orm/issues"
38
28
  },
39
- "homepage": "https://mikro-orm.io",
40
- "engines": {
41
- "node": ">= 22.11.0"
29
+ "license": "MIT",
30
+ "author": "Martin Adámek",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
34
+ },
35
+ "type": "module",
36
+ "exports": {
37
+ "./package.json": "./package.json",
38
+ ".": "./index.js"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
42
  },
43
43
  "scripts": {
44
- "build": "yarn clean && yarn compile && yarn copy",
44
+ "build": "yarn compile && yarn copy",
45
45
  "clean": "yarn run -T rimraf ./dist",
46
46
  "compile": "yarn run -T tsc -p tsconfig.build.json",
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
- "publishConfig": {
50
- "access": "public"
51
- },
52
49
  "dependencies": {
53
- "@mikro-orm/mongodb": "7.0.0-dev.33",
54
- "mongodb": "6.20.0",
55
- "umzug": "3.8.2"
50
+ "@mikro-orm/mongodb": "7.0.0-dev.330",
51
+ "mongodb": "7.1.0"
56
52
  },
57
53
  "devDependencies": {
58
- "@mikro-orm/core": "^6.5.7"
54
+ "@mikro-orm/core": "^6.6.9"
59
55
  },
60
56
  "peerDependencies": {
61
- "@mikro-orm/core": "7.0.0-dev.33"
57
+ "@mikro-orm/core": "7.0.0-dev.330"
58
+ },
59
+ "engines": {
60
+ "node": ">= 22.17.0"
62
61
  }
63
62
  }
package/typings.d.ts CHANGED
@@ -1 +1 @@
1
- export { UmzugMigration, MigrateOptions, MigrationResult, MigrationRow } from '@mikro-orm/core';
1
+ export type { MigrationInfo, MigrateOptions, MigrationResult, MigrationRow } from '@mikro-orm/core';