@spinajs/orm 2.0.486 → 2.0.488
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.
- package/lib/cjs/builders.d.ts +57 -0
- package/lib/cjs/builders.d.ts.map +1 -1
- package/lib/cjs/builders.js +94 -1
- package/lib/cjs/builders.js.map +1 -1
- package/lib/cjs/config/orm.d.ts +24 -0
- package/lib/cjs/config/orm.d.ts.map +1 -0
- package/lib/cjs/config/orm.js +26 -0
- package/lib/cjs/config/orm.js.map +1 -0
- package/lib/cjs/decorators.d.ts +3 -2
- package/lib/cjs/decorators.d.ts.map +1 -1
- package/lib/cjs/decorators.js +19 -2
- package/lib/cjs/decorators.js.map +1 -1
- package/lib/cjs/descriptor.d.ts +29 -1
- package/lib/cjs/descriptor.d.ts.map +1 -1
- package/lib/cjs/descriptor.js +37 -0
- package/lib/cjs/descriptor.js.map +1 -1
- package/lib/cjs/index.d.ts +6 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +6 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces.d.ts +58 -2
- package/lib/cjs/interfaces.d.ts.map +1 -1
- package/lib/cjs/interfaces.js +18 -1
- package/lib/cjs/interfaces.js.map +1 -1
- package/lib/cjs/migration-environment.d.ts +70 -0
- package/lib/cjs/migration-environment.d.ts.map +1 -0
- package/lib/cjs/migration-environment.js +134 -0
- package/lib/cjs/migration-environment.js.map +1 -0
- package/lib/cjs/migration-runner.d.ts +108 -0
- package/lib/cjs/migration-runner.d.ts.map +1 -0
- package/lib/cjs/migration-runner.js +216 -0
- package/lib/cjs/migration-runner.js.map +1 -0
- package/lib/cjs/migration-service.d.ts +300 -0
- package/lib/cjs/migration-service.d.ts.map +1 -0
- package/lib/cjs/migration-service.js +829 -0
- package/lib/cjs/migration-service.js.map +1 -0
- package/lib/cjs/migration-sources.d.ts +85 -0
- package/lib/cjs/migration-sources.d.ts.map +1 -0
- package/lib/cjs/migration-sources.js +277 -0
- package/lib/cjs/migration-sources.js.map +1 -0
- package/lib/cjs/orm.d.ts +77 -15
- package/lib/cjs/orm.d.ts.map +1 -1
- package/lib/cjs/orm.js +156 -150
- package/lib/cjs/orm.js.map +1 -1
- package/lib/cjs/quoting.d.ts +33 -0
- package/lib/cjs/quoting.d.ts.map +1 -0
- package/lib/cjs/quoting.js +48 -0
- package/lib/cjs/quoting.js.map +1 -0
- package/lib/cjs/source-file.d.ts +10 -0
- package/lib/cjs/source-file.d.ts.map +1 -0
- package/lib/cjs/source-file.js +41 -0
- package/lib/cjs/source-file.js.map +1 -0
- package/lib/cjs/statements.d.ts +51 -1
- package/lib/cjs/statements.d.ts.map +1 -1
- package/lib/cjs/statements.js +73 -1
- package/lib/cjs/statements.js.map +1 -1
- package/lib/cjs/symbols.d.ts +11 -0
- package/lib/cjs/symbols.d.ts.map +1 -1
- package/lib/cjs/symbols.js +12 -1
- package/lib/cjs/symbols.js.map +1 -1
- package/lib/mjs/builders.d.ts +57 -0
- package/lib/mjs/builders.d.ts.map +1 -1
- package/lib/mjs/builders.js +94 -1
- package/lib/mjs/builders.js.map +1 -1
- package/lib/mjs/config/orm.d.ts +24 -0
- package/lib/mjs/config/orm.d.ts.map +1 -0
- package/lib/mjs/config/orm.js +24 -0
- package/lib/mjs/config/orm.js.map +1 -0
- package/lib/mjs/decorators.d.ts +3 -2
- package/lib/mjs/decorators.d.ts.map +1 -1
- package/lib/mjs/decorators.js +19 -2
- package/lib/mjs/decorators.js.map +1 -1
- package/lib/mjs/descriptor.d.ts +29 -1
- package/lib/mjs/descriptor.d.ts.map +1 -1
- package/lib/mjs/descriptor.js +36 -1
- package/lib/mjs/descriptor.js.map +1 -1
- package/lib/mjs/index.d.ts +6 -0
- package/lib/mjs/index.d.ts.map +1 -1
- package/lib/mjs/index.js +6 -0
- package/lib/mjs/index.js.map +1 -1
- package/lib/mjs/interfaces.d.ts +58 -2
- package/lib/mjs/interfaces.d.ts.map +1 -1
- package/lib/mjs/interfaces.js +17 -0
- package/lib/mjs/interfaces.js.map +1 -1
- package/lib/mjs/migration-environment.d.ts +70 -0
- package/lib/mjs/migration-environment.d.ts.map +1 -0
- package/lib/mjs/migration-environment.js +128 -0
- package/lib/mjs/migration-environment.js.map +1 -0
- package/lib/mjs/migration-runner.d.ts +108 -0
- package/lib/mjs/migration-runner.d.ts.map +1 -0
- package/lib/mjs/migration-runner.js +211 -0
- package/lib/mjs/migration-runner.js.map +1 -0
- package/lib/mjs/migration-service.d.ts +300 -0
- package/lib/mjs/migration-service.d.ts.map +1 -0
- package/lib/mjs/migration-service.js +824 -0
- package/lib/mjs/migration-service.js.map +1 -0
- package/lib/mjs/migration-sources.d.ts +85 -0
- package/lib/mjs/migration-sources.d.ts.map +1 -0
- package/lib/mjs/migration-sources.js +236 -0
- package/lib/mjs/migration-sources.js.map +1 -0
- package/lib/mjs/orm.d.ts +77 -15
- package/lib/mjs/orm.d.ts.map +1 -1
- package/lib/mjs/orm.js +158 -152
- package/lib/mjs/orm.js.map +1 -1
- package/lib/mjs/quoting.d.ts +33 -0
- package/lib/mjs/quoting.d.ts.map +1 -0
- package/lib/mjs/quoting.js +45 -0
- package/lib/mjs/quoting.js.map +1 -0
- package/lib/mjs/source-file.d.ts +10 -0
- package/lib/mjs/source-file.d.ts.map +1 -0
- package/lib/mjs/source-file.js +38 -0
- package/lib/mjs/source-file.js.map +1 -0
- package/lib/mjs/statements.d.ts +51 -1
- package/lib/mjs/statements.d.ts.map +1 -1
- package/lib/mjs/statements.js +71 -0
- package/lib/mjs/statements.js.map +1 -1
- package/lib/mjs/symbols.d.ts +11 -0
- package/lib/mjs/symbols.d.ts.map +1 -1
- package/lib/mjs/symbols.js +11 -0
- package/lib/mjs/symbols.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +7 -7
package/lib/mjs/orm.js
CHANGED
|
@@ -8,92 +8,36 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { BooleanValueConverter, DatetimeValueConverter, TimeValueConverter } from './interfaces.js';
|
|
11
|
-
import { Configuration } from '@spinajs/configuration-common';
|
|
11
|
+
import { Configuration, normalizeEnvironment } from '@spinajs/configuration-common';
|
|
12
12
|
import { AsyncService, Autoinject, Container, DI } from '@spinajs/di';
|
|
13
13
|
import { Log, Logger } from '@spinajs/log-common';
|
|
14
14
|
import _ from 'lodash';
|
|
15
|
-
import { MigrationTransactionMode } from './interfaces.js';
|
|
16
15
|
import { MODEL_STATIC_MIXINS, updateModelDescriptor } from './model.js';
|
|
17
|
-
import { MIGRATION_DESCRIPTION_SYMBOL } from './symbols.js';
|
|
18
16
|
import { InvalidOperation } from '@spinajs/exceptions';
|
|
19
17
|
import { OrmException } from './exceptions.js';
|
|
20
18
|
import { DateTime } from 'luxon';
|
|
21
|
-
import { extractModelDescriptor } from './descriptor.js';
|
|
19
|
+
import { extractModelDescriptor, extractOwnMigrationDescriptor } from './descriptor.js';
|
|
22
20
|
import { buildModelJsonSchema } from './schema.js';
|
|
23
21
|
import { TimeSpan } from '@spinajs/util';
|
|
22
|
+
import { MIGRATION_FILE_REGEXP, MigrationRunner } from './migration-runner.js';
|
|
23
|
+
import { MIGRATION_DI_SOURCE, mergeMigrationEnv, resolveMigrationEnv } from './migration-environment.js';
|
|
24
|
+
import { MigrationSource } from './migration-sources.js';
|
|
24
25
|
/**
|
|
25
26
|
* Used to exclude sensitive data to others. eg. removed password field from cfg
|
|
26
27
|
*/
|
|
27
28
|
const CFG_PROPS = ['Database', 'User', 'Host', 'Port', 'Filename', 'Driver', 'Name'];
|
|
28
|
-
const MIGRATION_TABLE_NAME = 'spinajs_migration';
|
|
29
|
-
const MIGRATION_FILE_REGEXP = /(.*)_([0-9]{4}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2})/;
|
|
30
29
|
export class Orm extends AsyncService {
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
/**
|
|
31
|
+
* `DI.resolve(Orm)` leaves this empty, which is every application: the defaults are the
|
|
32
|
+
* documented behaviour and nothing has to opt into them.
|
|
33
|
+
*/
|
|
34
|
+
constructor(Options = {}) {
|
|
35
|
+
super();
|
|
36
|
+
this.Options = Options;
|
|
33
37
|
this.Models = [];
|
|
34
38
|
this.Migrations = [];
|
|
35
39
|
this.Connections = new Map();
|
|
36
40
|
}
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* Migrates schema up ( fill function is not executed )
|
|
40
|
-
*
|
|
41
|
-
* @param name - migration file name
|
|
42
|
-
*/
|
|
43
|
-
async migrateUp(name, force = true) {
|
|
44
|
-
this.Log.info('DB migration UP started ...');
|
|
45
|
-
const executedMigrations = [];
|
|
46
|
-
await this.executeAvaibleMigrations(name, async (migration, driver) => {
|
|
47
|
-
const trFunction = async (driver) => {
|
|
48
|
-
await migration.up(driver);
|
|
49
|
-
await driver
|
|
50
|
-
.insert()
|
|
51
|
-
.into(driver.Options.Migration?.Table ?? MIGRATION_TABLE_NAME)
|
|
52
|
-
.values({
|
|
53
|
-
Migration: migration.constructor.name,
|
|
54
|
-
CreatedAt: new Date(),
|
|
55
|
-
});
|
|
56
|
-
executedMigrations.push(migration);
|
|
57
|
-
this.Log.info(`Migration ${migration.constructor.name}:up() success !`);
|
|
58
|
-
};
|
|
59
|
-
if (driver.Options.Migration?.Transaction?.Mode === MigrationTransactionMode.PerMigration) {
|
|
60
|
-
await driver.transaction(trFunction);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
await trFunction(driver);
|
|
64
|
-
}
|
|
65
|
-
}, false, force);
|
|
66
|
-
this.Log.info('DB migration ended ...');
|
|
67
|
-
return executedMigrations;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* Migrates schema up ( fill function is not executed )
|
|
72
|
-
*
|
|
73
|
-
* @param name - migration file name
|
|
74
|
-
*/
|
|
75
|
-
async migrateDown(name, force = true) {
|
|
76
|
-
this.Log.info('DB migration DOWN started ...');
|
|
77
|
-
await this.executeAvaibleMigrations(name, async (migration, driver) => {
|
|
78
|
-
const trFunction = async (driver) => {
|
|
79
|
-
await migration.down(driver);
|
|
80
|
-
await driver
|
|
81
|
-
.del()
|
|
82
|
-
.from(driver.Options.Migration?.Table ?? MIGRATION_TABLE_NAME)
|
|
83
|
-
.where({
|
|
84
|
-
Migration: migration.constructor.name,
|
|
85
|
-
});
|
|
86
|
-
this.Log.info(`Migration down ${migration.constructor.name}:DOWN success !`);
|
|
87
|
-
};
|
|
88
|
-
if (driver.Options.Migration?.Transaction?.Mode === MigrationTransactionMode.PerMigration) {
|
|
89
|
-
await driver.transaction(trFunction);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
await trFunction(driver);
|
|
93
|
-
}
|
|
94
|
-
}, true, force);
|
|
95
|
-
this.Log.info('DB migration ended ...');
|
|
96
|
-
}
|
|
97
41
|
/**
|
|
98
42
|
* This function is exposed mainly for unit testing purposes. It reloads table information for models
|
|
99
43
|
* ORM always try to load table at resolve time
|
|
@@ -119,7 +63,7 @@ export class Orm extends AsyncService {
|
|
|
119
63
|
const existingColumn = _.find(descriptor.Columns, { Name: c.Name });
|
|
120
64
|
if (existingColumn) {
|
|
121
65
|
// Merge only defined properties from table info
|
|
122
|
-
Object.keys(c).forEach(key => {
|
|
66
|
+
Object.keys(c).forEach((key) => {
|
|
123
67
|
const columnKey = key;
|
|
124
68
|
if (c[columnKey] !== undefined) {
|
|
125
69
|
existingColumn[columnKey] = c[columnKey];
|
|
@@ -170,12 +114,11 @@ export class Orm extends AsyncService {
|
|
|
170
114
|
async resolve() {
|
|
171
115
|
await super.resolve();
|
|
172
116
|
await this.createConnections();
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
});
|
|
117
|
+
// Every registered MigrationSource, merged, env-filtered and deduped. Deliberately BEFORE the
|
|
118
|
+
// model registration below: a discovered file may declare models as well, and importing it
|
|
119
|
+
// has to happen before `__models__` is read.
|
|
120
|
+
for (const m of await this.discoverMigrations()) {
|
|
121
|
+
this.registerMigration(m.type, m.file);
|
|
179
122
|
}
|
|
180
123
|
const models = DI.getRegisteredTypes('__models__');
|
|
181
124
|
if (models) {
|
|
@@ -183,14 +126,84 @@ export class Orm extends AsyncService {
|
|
|
183
126
|
this.registerModel(m);
|
|
184
127
|
});
|
|
185
128
|
}
|
|
186
|
-
|
|
129
|
+
this.Migration = new MigrationRunner(this);
|
|
130
|
+
// Must precede the migration pass below: `Migration.up()` reaches `ensureStorage()`, which
|
|
131
|
+
// probes the tracking table with `driver.tableInfo()` - and a driver's `tableInfo()` may read
|
|
132
|
+
// the '__orm_db_value_converters__' container map that this call is what puts there. Running
|
|
133
|
+
// it afterwards left that map absent for the whole boot pass, which crashed every restart of
|
|
134
|
+
// an already-migrated database ( the first boot creates the table and skips the probe, so it
|
|
135
|
+
// never showed ). Nothing here touches the database or the models, so it is free to move up.
|
|
187
136
|
this.registerDefaultConverters();
|
|
137
|
+
// The boot migration pass, unless this Orm was resolved with MigrateOnStartup: false - see
|
|
138
|
+
// IOrmOptions. Suppressed here rather than inside the runner on purpose: `plan()` reads the
|
|
139
|
+
// OnStartup gate, so no `force` value can express "run nothing at all".
|
|
140
|
+
//
|
|
141
|
+
// force: false - the boot run honours each connection's Migration.OnStartup gate. Every
|
|
142
|
+
// other caller ( CLI, an explicit orm.Migration.up() ) defaults to force: true, because
|
|
143
|
+
// asking for a migration by hand is the explicit intent that gate exists to require.
|
|
144
|
+
const migrateOnStartup = this.Options.MigrateOnStartup !== false;
|
|
145
|
+
if (!migrateOnStartup) {
|
|
146
|
+
this.Log.trace('Boot migration pass skipped - this Orm was resolved with MigrateOnStartup: false. Nothing is applied by resolving it; orm.Migration is assigned and usable.');
|
|
147
|
+
}
|
|
148
|
+
// [] when suppressed, so the data() phase below has nothing to seed - which is correct: it
|
|
149
|
+
// seeds exactly what this pass applied, and this pass applied nothing.
|
|
150
|
+
const executedMigrations = migrateOnStartup ? await this.Migration.up(undefined, { force: false }) : [];
|
|
151
|
+
// reloadTableInfo / wireRelations / applyModelMixins and the data() phase all stay AFTER the
|
|
152
|
+
// migration pass: up() runs against a schema no model is wired to yet, data() against one
|
|
153
|
+
// that is.
|
|
188
154
|
await this.reloadTableInfo();
|
|
189
155
|
this.wireRelations();
|
|
190
156
|
this.applyModelMixins();
|
|
191
|
-
|
|
157
|
+
// Reached only if the pass above completed. A migration that throws takes this resolve down
|
|
158
|
+
// with it, and the migrations that had already succeeded in that pass keep their recorded
|
|
159
|
+
// schema while never reaching their `data()` - see the note on `runDataPhase`.
|
|
160
|
+
await this.runDataPhase(executedMigrations);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Runs the `data()` hook of every migration that was just applied - the seeding pass, which
|
|
164
|
+
* happens after models and relations are wired because that is what it is allowed to use.
|
|
165
|
+
*
|
|
166
|
+
* Every hook runs even when an earlier one throws, and the failures are reported together.
|
|
167
|
+
* Stopping at the first one leaves the migrations after it unseeded while their schema is
|
|
168
|
+
* already applied and recorded, so a rerun will not retry them: their tracking rows say
|
|
169
|
+
* "applied", and nothing would ever mention the seeds that never ran.
|
|
170
|
+
*
|
|
171
|
+
* KNOWN LOSS, and it is the same shape one level up: `executed` is what THIS run applied, and
|
|
172
|
+
* this phase runs after the whole run. A run in which M1 applies and M2 throws never reaches
|
|
173
|
+
* here at all - and M1's schema is already recorded, so the next boot does not find it pending,
|
|
174
|
+
* it never enters `executed`, and `M1.data()` never runs on any boot. Nothing reports it: the
|
|
175
|
+
* migration is applied and `status()` is clean.
|
|
176
|
+
*
|
|
177
|
+
* Not fixed here, because the tracking table has no notion of "applied but unseeded" and
|
|
178
|
+
* inventing one would make the seed phase a second, weaker migration state machine - `data()`
|
|
179
|
+
* has no `down()`, no checksum and no failure row, so a "seeded" column would be a claim
|
|
180
|
+
* nothing could verify or undo. It is documented instead ( packages/orm/docs,
|
|
181
|
+
* 10-schema-and-migrations.md ), where the guidance is the one thing that actually holds:
|
|
182
|
+
* write `data()` so that running it again is harmless.
|
|
183
|
+
*/
|
|
184
|
+
async runDataPhase(executed) {
|
|
185
|
+
// `error` is deliberately `unknown` and kept verbatim - a rejection value is not promoted to
|
|
186
|
+
// an Error, so `inner` still carries whatever the hook actually threw. `reason` is the
|
|
187
|
+
// human-readable rendering of it, computed once and used by both the log line and the aggregate.
|
|
188
|
+
const errors = [];
|
|
189
|
+
for (const m of executed) {
|
|
192
190
|
this.Log.trace(`Migrating data function for migration ${m.constructor.name} ...`);
|
|
193
|
-
|
|
191
|
+
try {
|
|
192
|
+
await m.data();
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
// a hook is free to reject with something that is not an Error - `throw 'boom'`,
|
|
196
|
+
// `Promise.reject(someCode)` - and reading `.message` off that yields undefined, so the
|
|
197
|
+
// message reporting the failure would name no reason for it at all
|
|
198
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
199
|
+
this.Log.error(`Migration ${m.constructor.name}:data() failed: ${reason}`);
|
|
200
|
+
errors.push({ name: m.constructor.name, reason, error: err });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (errors.length > 0) {
|
|
204
|
+
// the first failure is carried as `inner` - the aggregate message names them all, but a
|
|
205
|
+
// caller unwinding the chain gets the original rejection rather than this summary
|
|
206
|
+
throw new OrmException(`Migration data() phase failed for: ${errors.map((e) => `${e.name} (${e.reason})`).join(', ')}`, undefined, undefined, undefined, errors[0].error);
|
|
194
207
|
}
|
|
195
208
|
}
|
|
196
209
|
registerDefaultConverters() {
|
|
@@ -242,6 +255,65 @@ export class Orm extends AsyncService {
|
|
|
242
255
|
type: model,
|
|
243
256
|
});
|
|
244
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Everything every `MigrationSource` found, reduced to the migrations this environment runs.
|
|
260
|
+
*
|
|
261
|
+
* Three passes, in this order and for a reason each:
|
|
262
|
+
*
|
|
263
|
+
* - env resolution happens per ENTRY, before anything is merged, because it is the entry's FILE
|
|
264
|
+
* that carries the suffix;
|
|
265
|
+
* - dedupe merges entries sharing a class name - the normal case, since a file discovered on
|
|
266
|
+
* disk is also registered through DI by the import that discovered it, and `src` and `lib`
|
|
267
|
+
* hold the same class twice;
|
|
268
|
+
* - filtering happens here rather than in `MigrationRunner.plan()` so a migration belonging to
|
|
269
|
+
* another environment never enters `Orm.Migrations` at all, and is therefore absent from
|
|
270
|
+
* `up`, `down` AND `status` alike.
|
|
271
|
+
*/
|
|
272
|
+
async discoverMigrations() {
|
|
273
|
+
const sources = await this.Container.resolve(Array.ofType(MigrationSource));
|
|
274
|
+
const merged = new Map();
|
|
275
|
+
for (const source of sources) {
|
|
276
|
+
for (const found of await source.getMigrations()) {
|
|
277
|
+
// OWN only - see the note on `extractOwnMigrationDescriptor`. A subclass that carries no
|
|
278
|
+
// `@Migration()` of its own must be read as "no Env declared", not as whatever its nearest
|
|
279
|
+
// decorated ancestor declared: a subclass does not inherit WHERE its parent runs.
|
|
280
|
+
const descriptor = extractOwnMigrationDescriptor(found.type);
|
|
281
|
+
const env = resolveMigrationEnv(found.name, found.file, descriptor?.Env);
|
|
282
|
+
const previous = merged.get(found.name);
|
|
283
|
+
if (!previous) {
|
|
284
|
+
merged.set(found.name, { type: found.type, file: found.file, env });
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (previous.type !== found.type) {
|
|
288
|
+
// two DIFFERENT classes under one name - the runner records migrations by name, so only
|
|
289
|
+
// one of them can ever be tracked. Nothing here can tell which is meant. The env merge
|
|
290
|
+
// below is skipped on purpose: merging environments across two unrelated classes would
|
|
291
|
+
// surface as "the same migration cannot belong to two environments", contradicting the
|
|
292
|
+
// warning just logged - so the first entry is kept untouched instead.
|
|
293
|
+
this.Log.warn(`Two different migration classes are both named ${found.name} ( ${previous.file} and ${found.file} ) - keeping the first. Rename one of them.`);
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
// Prefer a real path over the '<di>' sentinel: each ClassInfo.file is meant to carry the
|
|
297
|
+
// migration's actual origin, and a DI registration that resolved before the file-scan
|
|
298
|
+
// source ran must not make the survivor forget the real path the same class was also
|
|
299
|
+
// discovered at.
|
|
300
|
+
const file = previous.file === MIGRATION_DI_SOURCE && found.file !== MIGRATION_DI_SOURCE ? found.file : previous.file;
|
|
301
|
+
merged.set(found.name, {
|
|
302
|
+
type: previous.type,
|
|
303
|
+
file,
|
|
304
|
+
env: mergeMigrationEnv(found.name, { env: previous.env, file: previous.file }, { env, file: found.file }),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const environment = normalizeEnvironment(this.Configuration.get('process.env.APP_ENV', undefined));
|
|
309
|
+
return [...merged.values()].filter((m) => {
|
|
310
|
+
if (m.env === undefined || m.env === environment) {
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
this.Log.trace(`Migration ${m.type.name} belongs to environment '${m.env}' and this process runs as '${environment}' - it is not registered`);
|
|
314
|
+
return false;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
245
317
|
/**
|
|
246
318
|
*
|
|
247
319
|
* Register migration to ORM programatically so ORM can see it and use it. Sometimes dynamical migration discovery is not possible eg.
|
|
@@ -251,13 +323,17 @@ export class Orm extends AsyncService {
|
|
|
251
323
|
*
|
|
252
324
|
* @param model - model to register
|
|
253
325
|
*/
|
|
254
|
-
registerMigration(migration) {
|
|
255
|
-
|
|
256
|
-
|
|
326
|
+
registerMigration(migration, file) {
|
|
327
|
+
// validated here as well as in the runner, and deliberately: this is the earliest point the
|
|
328
|
+
// class is seen, so a migration nobody can order is refused before the Orm reports itself
|
|
329
|
+
// resolved rather than at the first migration run, possibly in another process
|
|
330
|
+
const match = migration.name.match(MIGRATION_FILE_REGEXP);
|
|
331
|
+
const created = match && match.length === 3 ? DateTime.fromFormat(match[2], 'yyyy_MM_dd_HH_mm_ss') : null;
|
|
332
|
+
if (created === null || !created.isValid) {
|
|
257
333
|
throw new OrmException(`Migration file ${migration.name} have invalid name format ( invalid migration name, expected: some_name_yyyy_MM_dd_HH_mm_ss got ${migration.name})`);
|
|
258
334
|
}
|
|
259
335
|
this.Migrations.push({
|
|
260
|
-
file: `${migration.name}.registered`,
|
|
336
|
+
file: file ?? `${migration.name}.registered`,
|
|
261
337
|
name: `${migration.name}`,
|
|
262
338
|
type: migration,
|
|
263
339
|
});
|
|
@@ -333,76 +409,6 @@ export class Orm extends AsyncService {
|
|
|
333
409
|
}
|
|
334
410
|
});
|
|
335
411
|
}
|
|
336
|
-
getMigrationDate(migration) {
|
|
337
|
-
const match = migration.name.match(MIGRATION_FILE_REGEXP);
|
|
338
|
-
if (match === null || match.length !== 3) {
|
|
339
|
-
return null;
|
|
340
|
-
}
|
|
341
|
-
const created = DateTime.fromFormat(match[2], 'yyyy_MM_dd_HH_mm_ss');
|
|
342
|
-
if (!created.isValid) {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
return created;
|
|
346
|
-
}
|
|
347
|
-
async executeAvaibleMigrations(name, callback, down, force) {
|
|
348
|
-
const toMigrate = name ? this.Migrations.filter((m) => m.name === name) : this.Migrations;
|
|
349
|
-
let migrations = toMigrate
|
|
350
|
-
.map((x) => {
|
|
351
|
-
const created = this.getMigrationDate(x.type);
|
|
352
|
-
if (created === null) {
|
|
353
|
-
throw new OrmException(`Migration file ${x.name} have invalid name format ( invalid migration name, expected: some_name_yyyy_MM_dd_HH_mm_ss got ${x.name})`);
|
|
354
|
-
}
|
|
355
|
-
return {
|
|
356
|
-
created,
|
|
357
|
-
...x,
|
|
358
|
-
};
|
|
359
|
-
})
|
|
360
|
-
.filter((x) => x !== null)
|
|
361
|
-
.sort((a, b) => {
|
|
362
|
-
if (a.created < b.created) {
|
|
363
|
-
return -1;
|
|
364
|
-
}
|
|
365
|
-
return 1;
|
|
366
|
-
});
|
|
367
|
-
if (down) {
|
|
368
|
-
migrations = migrations.reverse();
|
|
369
|
-
}
|
|
370
|
-
for (const m of migrations) {
|
|
371
|
-
const md = m.type[MIGRATION_DESCRIPTION_SYMBOL];
|
|
372
|
-
const cn = this.Connections.get(md.Connection);
|
|
373
|
-
if (!cn) {
|
|
374
|
-
this.Log.warn(`Connection ${md.Connection} not exists for migration ${m.name} at file ${m.file}`);
|
|
375
|
-
continue;
|
|
376
|
-
}
|
|
377
|
-
const migrationTableName = cn.Options.Migration?.Table ?? MIGRATION_TABLE_NAME;
|
|
378
|
-
if (!cn.Options.Migration?.OnStartup) {
|
|
379
|
-
if (!force) {
|
|
380
|
-
this.Log.warn(`Migration for connection ${md.Connection} is disabled on startup, please check conf file for db.[connection].migration.OnStartup property`);
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
// if there is no info on migraiton table
|
|
385
|
-
const migrationTableExists = await cn.schema().tableExists(migrationTableName, cn.Options.Database);
|
|
386
|
-
if (!migrationTableExists) {
|
|
387
|
-
this.Log.info(`No migration table in database, recreating migration information ...`);
|
|
388
|
-
await cn.schema().createTable(migrationTableName, (table) => {
|
|
389
|
-
table.string('Migration').unique().notNull();
|
|
390
|
-
table.dateTime('CreatedAt').notNull();
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
const exists = await cn.select().from(migrationTableName).where({ Migration: m.name }).orderByDescending('CreatedAt').first();
|
|
394
|
-
// up() must run only for migrations NOT yet recorded; down() must run only
|
|
395
|
-
// for migrations that ARE recorded (previously applied). The gate was
|
|
396
|
-
// inverted for down, which skipped applied migrations and ran down() on
|
|
397
|
-
// never-applied ones.
|
|
398
|
-
const shouldRun = down ? Boolean(exists) : !exists;
|
|
399
|
-
if (shouldRun) {
|
|
400
|
-
const migration = await this.Container.resolve(m.type, [cn]);
|
|
401
|
-
this.Log.info(`Setting up migration ${m.name} from file ${m.file} created at ${m.created} mode: ${down ? 'migrate down' : 'migrate up'}`);
|
|
402
|
-
await callback(migration, cn);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
412
|
async dispose() {
|
|
407
413
|
for (const [, value] of this.Connections) {
|
|
408
414
|
value.stopHealthCheck();
|
package/lib/mjs/orm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orm.js","sourceRoot":"","sources":["../../src/orm.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAmB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAa,UAAU,EAAE,SAAS,EAAS,EAAE,EAAc,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAsD,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAa,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACrF,MAAM,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AAK,CAAC,OAAO;QAClB,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACzC,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAvcQ;IADN,UAAU,EAAE;8BACK,SAAS;sCAAC;AAGlB;IADT,MAAM,CAAC,KAAK,CAAC;8BACC,GAAG;gCAAC;AAGT;IADT,UAAU,EAAE;8BACY,aAAa;0CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quotes identifiers — table, column and alias names — the way one dialect spells them.
|
|
3
|
+
*
|
|
4
|
+
* Resolved from the DRIVER's container like every other compiler and statement, so a
|
|
5
|
+
* driver picks its quoting the same way it picks its SQL. This used to be a module-level
|
|
6
|
+
* function in `@spinajs/orm-sql` that emitted backticks and was imported directly by
|
|
7
|
+
* nearly every shared statement and compiler — including MSSQL's own, which therefore
|
|
8
|
+
* produced `` `table` `` where SQL Server needs `[table]`. Shadowing a compiler cannot
|
|
9
|
+
* shadow a function it calls internally, so quoting had to become a service before the
|
|
10
|
+
* "each driver registers its own dialect" rule could hold for identifiers at all.
|
|
11
|
+
*
|
|
12
|
+
* There is deliberately NO default registration. Backticks are MySQL and SQLite;
|
|
13
|
+
* brackets are MSSQL; the ANSI double quote is rejected by MySQL unless `ANSI_QUOTES` is
|
|
14
|
+
* on. Nothing is portable here, so nothing is inherited: a driver that registers no
|
|
15
|
+
* quoter fails loudly on its first query instead of emitting another dialect's SQL.
|
|
16
|
+
*/
|
|
17
|
+
export declare abstract class IdentifierQuoter {
|
|
18
|
+
/**
|
|
19
|
+
* Quotes one identifier, escaping the quote character if the name contains it.
|
|
20
|
+
*/
|
|
21
|
+
abstract quote(name: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Quotes a possibly schema-qualified name, quoting each dot-separated part on its own:
|
|
24
|
+
* `schema.table` becomes `` `schema`.`table` ``, never `` `schema.table` `` — the latter
|
|
25
|
+
* is a single identifier and every one of these databases rejects it as a table
|
|
26
|
+
* reference.
|
|
27
|
+
*
|
|
28
|
+
* A table whose name genuinely contains a dot cannot be expressed through the APIs that
|
|
29
|
+
* take a qualified name as one string; it never could.
|
|
30
|
+
*/
|
|
31
|
+
quoteQualified(name: string): string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=quoting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoting.d.ts","sourceRoot":"","sources":["../../src/quoting.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,8BACsB,gBAAgB;IACpC;;OAEG;aACa,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAE3C;;;;;;;;OAQG;IACI,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAM5C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { NewInstance } from '@spinajs/di';
|
|
8
|
+
/**
|
|
9
|
+
* Quotes identifiers — table, column and alias names — the way one dialect spells them.
|
|
10
|
+
*
|
|
11
|
+
* Resolved from the DRIVER's container like every other compiler and statement, so a
|
|
12
|
+
* driver picks its quoting the same way it picks its SQL. This used to be a module-level
|
|
13
|
+
* function in `@spinajs/orm-sql` that emitted backticks and was imported directly by
|
|
14
|
+
* nearly every shared statement and compiler — including MSSQL's own, which therefore
|
|
15
|
+
* produced `` `table` `` where SQL Server needs `[table]`. Shadowing a compiler cannot
|
|
16
|
+
* shadow a function it calls internally, so quoting had to become a service before the
|
|
17
|
+
* "each driver registers its own dialect" rule could hold for identifiers at all.
|
|
18
|
+
*
|
|
19
|
+
* There is deliberately NO default registration. Backticks are MySQL and SQLite;
|
|
20
|
+
* brackets are MSSQL; the ANSI double quote is rejected by MySQL unless `ANSI_QUOTES` is
|
|
21
|
+
* on. Nothing is portable here, so nothing is inherited: a driver that registers no
|
|
22
|
+
* quoter fails loudly on its first query instead of emitting another dialect's SQL.
|
|
23
|
+
*/
|
|
24
|
+
let IdentifierQuoter = class IdentifierQuoter {
|
|
25
|
+
/**
|
|
26
|
+
* Quotes a possibly schema-qualified name, quoting each dot-separated part on its own:
|
|
27
|
+
* `schema.table` becomes `` `schema`.`table` ``, never `` `schema.table` `` — the latter
|
|
28
|
+
* is a single identifier and every one of these databases rejects it as a table
|
|
29
|
+
* reference.
|
|
30
|
+
*
|
|
31
|
+
* A table whose name genuinely contains a dot cannot be expressed through the APIs that
|
|
32
|
+
* take a qualified name as one string; it never could.
|
|
33
|
+
*/
|
|
34
|
+
quoteQualified(name) {
|
|
35
|
+
return String(name)
|
|
36
|
+
.split('.')
|
|
37
|
+
.map((part) => this.quote(part))
|
|
38
|
+
.join('.');
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
IdentifierQuoter = __decorate([
|
|
42
|
+
NewInstance()
|
|
43
|
+
], IdentifierQuoter);
|
|
44
|
+
export { IdentifierQuoter };
|
|
45
|
+
//# sourceMappingURL=quoting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoting.js","sourceRoot":"","sources":["../../src/quoting.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AAEI,IAAe,gBAAgB,GAA/B,MAAe,gBAAgB;IAMpC;;;;;;;;OAQG;IACI,cAAc,CAAC,IAAY;QAChC,OAAO,MAAM,CAAC,IAAI,CAAC;aAChB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC/B,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;CACF,CAAA;AArBqB,gBAAgB;IADrC,WAAW,EAAE;GACQ,gBAAgB,CAqBrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk the current V8 stack and return the absolute path of the first frame that is NOT inside
|
|
3
|
+
* one of `skipMarkers`. Called from a decorator, that frame is the decorated class's own source
|
|
4
|
+
* file. Works for CJS ( `at ... (C:\foo\bar.js:12:3)` ) and ESM ( `at ... (file:///C:/foo/bar.js:12:3)` ).
|
|
5
|
+
*
|
|
6
|
+
* Lifted from `@spinajs/http`'s `captureControllerSourceFile` - the two packages cannot share it
|
|
7
|
+
* without one depending on the other, and http sits above orm in the graph.
|
|
8
|
+
*/
|
|
9
|
+
export declare function captureSourceFile(skipMarkers: string[]): string | undefined;
|
|
10
|
+
//# sourceMappingURL=source-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.d.ts","sourceRoot":"","sources":["../../src/source-file.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CA+B3E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk the current V8 stack and return the absolute path of the first frame that is NOT inside
|
|
3
|
+
* one of `skipMarkers`. Called from a decorator, that frame is the decorated class's own source
|
|
4
|
+
* file. Works for CJS ( `at ... (C:\foo\bar.js:12:3)` ) and ESM ( `at ... (file:///C:/foo/bar.js:12:3)` ).
|
|
5
|
+
*
|
|
6
|
+
* Lifted from `@spinajs/http`'s `captureControllerSourceFile` - the two packages cannot share it
|
|
7
|
+
* without one depending on the other, and http sits above orm in the graph.
|
|
8
|
+
*/
|
|
9
|
+
export function captureSourceFile(skipMarkers) {
|
|
10
|
+
const stack = new Error().stack;
|
|
11
|
+
if (!stack)
|
|
12
|
+
return undefined;
|
|
13
|
+
const lines = stack.split('\n');
|
|
14
|
+
for (const line of lines) {
|
|
15
|
+
if (skipMarkers.some((m) => line.includes(m)))
|
|
16
|
+
continue;
|
|
17
|
+
// Match `(path:line:col)` or bare `path:line:col` at the end of the frame.
|
|
18
|
+
const m = line.match(/\(([^()]+):\d+:\d+\)\s*$/) || line.match(/at\s+([^\s()]+):\d+:\d+\s*$/);
|
|
19
|
+
if (!m)
|
|
20
|
+
continue;
|
|
21
|
+
let file = m[1];
|
|
22
|
+
if (file.startsWith('file://')) {
|
|
23
|
+
try {
|
|
24
|
+
// Strip the ESM url scheme. Windows: file:///C:/foo -> C:/foo, POSIX paths stay as-is.
|
|
25
|
+
file = decodeURIComponent(file.replace(/^file:\/\/\/?/, ''));
|
|
26
|
+
if (!/^[A-Za-z]:/.test(file) && !file.startsWith('/')) {
|
|
27
|
+
file = `/${file}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// fall through with the raw match
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return file;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=source-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.js","sourceRoot":"","sources":["../../src/source-file.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAqB;IACrD,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAChC,IAAI,CAAC,KAAK;QAAE,OAAO,SA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