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