@neupgroup/mapper 1.7.1 → 1.7.3

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.
@@ -7,6 +7,7 @@ export declare class SchemaCreator {
7
7
  private ensureRegistration;
8
8
  addColumn(name: string): import("../migrator.js").ColumnBuilder;
9
9
  structure(config: any): this;
10
+ useConnection(connectionName: string): this;
10
11
  exec(): Promise<void>;
11
12
  }
12
13
  export declare class SchemaUpdater {
@@ -17,11 +18,14 @@ export declare class SchemaUpdater {
17
18
  addColumn(name: string): import("../migrator.js").ColumnBuilder;
18
19
  selectColumn(name: string): import("../migrator.js").ColumnBuilder;
19
20
  dropColumn(name: string): this;
21
+ useConnection(connectionName: string): this;
20
22
  exec(): Promise<void>;
21
23
  }
22
24
  export declare class SchemaDropper {
23
25
  private name;
24
26
  constructor(name: string);
27
+ private connectionName;
28
+ useConnection(name: string): this;
25
29
  exec(): Promise<void>;
26
30
  }
27
31
  export declare class SchemaHandler {
@@ -28,6 +28,14 @@ export class SchemaCreator {
28
28
  }
29
29
  return this;
30
30
  }
31
+ useConnection(connectionName) {
32
+ this.migrator.useConnection(connectionName);
33
+ // Also update in-memory definition
34
+ const def = this.mapper.getSchemaManager().schemas.get(this.name);
35
+ if (def)
36
+ def.connectionName = connectionName;
37
+ return this;
38
+ }
31
39
  async exec() {
32
40
  return this.migrator.exec();
33
41
  }
@@ -41,6 +49,10 @@ export class SchemaUpdater {
41
49
  addColumn(name) { return this.migrator.addColumn(name); }
42
50
  selectColumn(name) { return this.migrator.selectColumn(name); }
43
51
  dropColumn(name) { this.migrator.dropColumn(name); return this; }
52
+ useConnection(connectionName) {
53
+ this.migrator.useConnection(connectionName);
54
+ return this;
55
+ }
44
56
  async exec() {
45
57
  return this.migrator.exec();
46
58
  }
@@ -48,9 +60,16 @@ export class SchemaUpdater {
48
60
  export class SchemaDropper {
49
61
  constructor(name) {
50
62
  this.name = name;
63
+ this.connectionName = 'default';
64
+ }
65
+ useConnection(name) {
66
+ this.connectionName = name;
67
+ return this;
51
68
  }
52
69
  async exec() {
53
- return new TableMigrator(this.name).drop().exec();
70
+ const migrator = new TableMigrator(this.name);
71
+ migrator.useConnection(this.connectionName);
72
+ return migrator.drop().exec();
54
73
  }
55
74
  }
56
75
  export class SchemaHandler {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neupgroup/mapper",
3
3
  "description": "Neup.Mapper core library for schema and mapping utilities",
4
- "version": "1.7.1",
4
+ "version": "1.7.3",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",