@argos-js/data 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +799 -2
- package/dist/connection/index.d.ts +2 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +18 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/connection/manager.d.ts +93 -0
- package/dist/connection/manager.d.ts.map +1 -0
- package/dist/connection/manager.js +194 -0
- package/dist/connection/manager.js.map +1 -0
- package/dist/database.d.ts +29 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +276 -0
- package/dist/database.js.map +1 -0
- package/dist/drivers/base-driver.d.ts +18 -0
- package/dist/drivers/base-driver.d.ts.map +1 -0
- package/dist/drivers/base-driver.js +211 -0
- package/dist/drivers/base-driver.js.map +1 -0
- package/dist/drivers/index.d.ts +11 -0
- package/dist/drivers/index.d.ts.map +1 -0
- package/dist/drivers/index.js +55 -0
- package/dist/drivers/index.js.map +1 -0
- package/dist/drivers/mavedb-edge.d.ts +8 -0
- package/dist/drivers/mavedb-edge.d.ts.map +1 -0
- package/dist/drivers/mavedb-edge.js +18 -0
- package/dist/drivers/mavedb-edge.js.map +1 -0
- package/dist/drivers/mongodb.d.ts +8 -0
- package/dist/drivers/mongodb.d.ts.map +1 -0
- package/dist/drivers/mongodb.js +18 -0
- package/dist/drivers/mongodb.js.map +1 -0
- package/dist/drivers/mssql.d.ts +8 -0
- package/dist/drivers/mssql.d.ts.map +1 -0
- package/dist/drivers/mssql.js +18 -0
- package/dist/drivers/mssql.js.map +1 -0
- package/dist/drivers/mysql.d.ts +8 -0
- package/dist/drivers/mysql.d.ts.map +1 -0
- package/dist/drivers/mysql.js +18 -0
- package/dist/drivers/mysql.js.map +1 -0
- package/dist/drivers/postgres.d.ts +8 -0
- package/dist/drivers/postgres.d.ts.map +1 -0
- package/dist/drivers/postgres.js +18 -0
- package/dist/drivers/postgres.js.map +1 -0
- package/dist/drivers/redis.d.ts +9 -0
- package/dist/drivers/redis.d.ts.map +1 -0
- package/dist/drivers/redis.js +50 -0
- package/dist/drivers/redis.js.map +1 -0
- package/dist/drivers/sqlite.d.ts +8 -0
- package/dist/drivers/sqlite.d.ts.map +1 -0
- package/dist/drivers/sqlite.js +18 -0
- package/dist/drivers/sqlite.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +7 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +23 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/migrator.d.ts +79 -0
- package/dist/migrations/migrator.d.ts.map +1 -0
- package/dist/migrations/migrator.js +274 -0
- package/dist/migrations/migrator.js.map +1 -0
- package/dist/migrations/schema-builder.d.ts +318 -0
- package/dist/migrations/schema-builder.d.ts.map +1 -0
- package/dist/migrations/schema-builder.js +957 -0
- package/dist/migrations/schema-builder.js.map +1 -0
- package/dist/migrations/types.d.ts +58 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +3 -0
- package/dist/migrations/types.js.map +1 -0
- package/dist/model.d.ts +107 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +333 -0
- package/dist/model.js.map +1 -0
- package/dist/plugin.d.ts +38 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +83 -0
- package/dist/plugin.js.map +1 -0
- package/dist/query-builder.d.ts +58 -0
- package/dist/query-builder.d.ts.map +1 -0
- package/dist/query-builder.js +534 -0
- package/dist/query-builder.js.map +1 -0
- package/dist/schema-adapter.d.ts +34 -0
- package/dist/schema-adapter.d.ts.map +1 -0
- package/dist/schema-adapter.js +511 -0
- package/dist/schema-adapter.js.map +1 -0
- package/dist/schema.d.ts +104 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +190 -0
- package/dist/schema.js.map +1 -0
- package/dist/seeds/index.d.ts +3 -0
- package/dist/seeds/index.d.ts.map +1 -0
- package/dist/seeds/index.js +19 -0
- package/dist/seeds/index.js.map +1 -0
- package/dist/seeds/seeder.d.ts +27 -0
- package/dist/seeds/seeder.d.ts.map +1 -0
- package/dist/seeds/seeder.js +138 -0
- package/dist/seeds/seeder.js.map +1 -0
- package/dist/seeds/types.d.ts +60 -0
- package/dist/seeds/types.d.ts.map +1 -0
- package/dist/seeds/types.js +3 -0
- package/dist/seeds/types.js.map +1 -0
- package/dist/sync/dump.d.ts +80 -0
- package/dist/sync/dump.d.ts.map +1 -0
- package/dist/sync/dump.js +655 -0
- package/dist/sync/dump.js.map +1 -0
- package/dist/sync/index.d.ts +5 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +21 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/introspector.d.ts +49 -0
- package/dist/sync/introspector.d.ts.map +1 -0
- package/dist/sync/introspector.js +750 -0
- package/dist/sync/introspector.js.map +1 -0
- package/dist/sync/synchronizer.d.ts +50 -0
- package/dist/sync/synchronizer.d.ts.map +1 -0
- package/dist/sync/synchronizer.js +506 -0
- package/dist/sync/synchronizer.js.map +1 -0
- package/dist/sync/types.d.ts +83 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +3 -0
- package/dist/sync/types.js.map +1 -0
- package/dist/tenant/sequence.d.ts +36 -0
- package/dist/tenant/sequence.d.ts.map +1 -0
- package/dist/tenant/sequence.js +130 -0
- package/dist/tenant/sequence.js.map +1 -0
- package/dist/types.d.ts +81 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +38 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,GAAG,EACH,EAAE,EACF,EAAE,EACF,EAAE,EACF,GAAG,EACH,EAAE,EACF,GAAG,EACH,IAAI,EACJ,KAAK,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,SAAS,EACT,GAAG,EACH,IAAI,EACJ,GAAG,EACH,EAAE,GACH,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.or = exports.and = exports.desc = exports.asc = exports.isNotNull = exports.isNull = exports.notInArray = exports.inArray = exports.ilike = exports.like = exports.lte = exports.lt = exports.gte = exports.gt = exports.ne = exports.eq = exports.sql = void 0;
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./schema"), exports);
|
|
20
|
+
__exportStar(require("./schema-adapter"), exports);
|
|
21
|
+
__exportStar(require("./query-builder"), exports);
|
|
22
|
+
__exportStar(require("./database"), exports);
|
|
23
|
+
__exportStar(require("./model"), exports);
|
|
24
|
+
__exportStar(require("./plugin"), exports);
|
|
25
|
+
__exportStar(require("./migrations"), exports);
|
|
26
|
+
__exportStar(require("./tenant/sequence"), exports);
|
|
27
|
+
__exportStar(require("./connection"), exports);
|
|
28
|
+
__exportStar(require("./sync"), exports);
|
|
29
|
+
__exportStar(require("./seeds"), exports);
|
|
30
|
+
// Re-export common Drizzle SQL operators for developer convenience
|
|
31
|
+
var drizzle_orm_1 = require("drizzle-orm");
|
|
32
|
+
Object.defineProperty(exports, "sql", { enumerable: true, get: function () { return drizzle_orm_1.sql; } });
|
|
33
|
+
Object.defineProperty(exports, "eq", { enumerable: true, get: function () { return drizzle_orm_1.eq; } });
|
|
34
|
+
Object.defineProperty(exports, "ne", { enumerable: true, get: function () { return drizzle_orm_1.ne; } });
|
|
35
|
+
Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return drizzle_orm_1.gt; } });
|
|
36
|
+
Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return drizzle_orm_1.gte; } });
|
|
37
|
+
Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return drizzle_orm_1.lt; } });
|
|
38
|
+
Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return drizzle_orm_1.lte; } });
|
|
39
|
+
Object.defineProperty(exports, "like", { enumerable: true, get: function () { return drizzle_orm_1.like; } });
|
|
40
|
+
Object.defineProperty(exports, "ilike", { enumerable: true, get: function () { return drizzle_orm_1.ilike; } });
|
|
41
|
+
Object.defineProperty(exports, "inArray", { enumerable: true, get: function () { return drizzle_orm_1.inArray; } });
|
|
42
|
+
Object.defineProperty(exports, "notInArray", { enumerable: true, get: function () { return drizzle_orm_1.notInArray; } });
|
|
43
|
+
Object.defineProperty(exports, "isNull", { enumerable: true, get: function () { return drizzle_orm_1.isNull; } });
|
|
44
|
+
Object.defineProperty(exports, "isNotNull", { enumerable: true, get: function () { return drizzle_orm_1.isNotNull; } });
|
|
45
|
+
Object.defineProperty(exports, "asc", { enumerable: true, get: function () { return drizzle_orm_1.asc; } });
|
|
46
|
+
Object.defineProperty(exports, "desc", { enumerable: true, get: function () { return drizzle_orm_1.desc; } });
|
|
47
|
+
Object.defineProperty(exports, "and", { enumerable: true, get: function () { return drizzle_orm_1.and; } });
|
|
48
|
+
Object.defineProperty(exports, "or", { enumerable: true, get: function () { return drizzle_orm_1.or; } });
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,mDAAiC;AACjC,kDAAgC;AAChC,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,oDAAkC;AAClC,+CAA6B;AAC7B,yCAAuB;AACvB,0CAAwB;AAExB,mEAAmE;AACnE,2CAkBqB;AAjBnB,kGAAA,GAAG,OAAA;AACH,iGAAA,EAAE,OAAA;AACF,iGAAA,EAAE,OAAA;AACF,iGAAA,EAAE,OAAA;AACF,kGAAA,GAAG,OAAA;AACH,iGAAA,EAAE,OAAA;AACF,kGAAA,GAAG,OAAA;AACH,mGAAA,IAAI,OAAA;AACJ,oGAAA,KAAK,OAAA;AACL,sGAAA,OAAO,OAAA;AACP,yGAAA,UAAU,OAAA;AACV,qGAAA,MAAM,OAAA;AACN,wGAAA,SAAS,OAAA;AACT,kGAAA,GAAG,OAAA;AACH,mGAAA,IAAI,OAAA;AACJ,kGAAA,GAAG,OAAA;AACH,iGAAA,EAAE,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @argos-js/data migrations module
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
__exportStar(require("./migrator"), exports);
|
|
22
|
+
__exportStar(require("./schema-builder"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,6CAA2B;AAC3B,mDAAiC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { DatabaseClient } from '../database';
|
|
2
|
+
import type { MigrateResult, MigrationModule, MigrationRecord, MigrationStatusItem, RollbackResult } from './types';
|
|
3
|
+
export interface MigratorOptions {
|
|
4
|
+
migrationsDir?: string | undefined;
|
|
5
|
+
loader?: ((filePath: string) => Promise<MigrationModule>) | undefined;
|
|
6
|
+
connection?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Argos-JS Transactional SQL Migration Engine
|
|
10
|
+
*
|
|
11
|
+
* Handles creation of the internal _argos_migrations tracking table,
|
|
12
|
+
* executes pending migrations in transactions, tracks batches, provides rollbacks,
|
|
13
|
+
* and reports detailed migration status.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Migrator {
|
|
16
|
+
private db;
|
|
17
|
+
private migrationsDir;
|
|
18
|
+
private customLoader?;
|
|
19
|
+
constructor(dbOrConnection?: DatabaseClient | string, options?: MigratorOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Formats parameter placeholders across database drivers ($1 for pg, ? for others).
|
|
22
|
+
*/
|
|
23
|
+
private formatQuery;
|
|
24
|
+
/**
|
|
25
|
+
* Ensures the internal _argos_migrations table exists in the connected database.
|
|
26
|
+
*/
|
|
27
|
+
ensureMigrationsTable(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns all executed migration records from _argos_migrations ordered by id ASC.
|
|
30
|
+
*/
|
|
31
|
+
getExecutedMigrations(): Promise<MigrationRecord[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Scans migrations directory for all migration files (*.ts, *.js), sorted lexicographically.
|
|
34
|
+
*/
|
|
35
|
+
getMigrationFiles(): {
|
|
36
|
+
name: string;
|
|
37
|
+
fullPath: string;
|
|
38
|
+
}[];
|
|
39
|
+
/**
|
|
40
|
+
* Returns files that have not yet been executed in _argos_migrations.
|
|
41
|
+
*/
|
|
42
|
+
getPendingMigrations(): Promise<{
|
|
43
|
+
name: string;
|
|
44
|
+
fullPath: string;
|
|
45
|
+
}[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the current maximum batch number (or 0 if no migrations have been executed).
|
|
48
|
+
*/
|
|
49
|
+
getCurrentBatch(): Promise<number>;
|
|
50
|
+
/**
|
|
51
|
+
* Official migration runner.
|
|
52
|
+
* Executes all pending migrations in chronological order within a transaction per migration,
|
|
53
|
+
* tracking batch and execution duration.
|
|
54
|
+
*/
|
|
55
|
+
runPendingMigrations(): Promise<MigrateResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Transparent alias for runPendingMigrations().
|
|
58
|
+
*/
|
|
59
|
+
migrate(): Promise<MigrateResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Official rollback runner.
|
|
62
|
+
* Reverts all migrations executed in the latest batch in reverse chronological order.
|
|
63
|
+
*/
|
|
64
|
+
rollbackLastBatch(): Promise<RollbackResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Transparent alias for rollbackLastBatch().
|
|
67
|
+
*/
|
|
68
|
+
rollback(): Promise<RollbackResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns a complete list of all local migrations with their status (applied | pending),
|
|
71
|
+
* associated batch number, and execution timestamp.
|
|
72
|
+
*/
|
|
73
|
+
getMigrationStatus(): Promise<MigrationStatusItem[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Loads a migration module dynamically.
|
|
76
|
+
*/
|
|
77
|
+
private loadMigration;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=migrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../src/migrations/migrator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,mBAAmB,EAEnB,cAAc,EACf,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC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s");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const node_url_1 = require("node:url");
|
|
7
|
+
const schema_builder_1 = require("./schema-builder");
|
|
8
|
+
const manager_1 = require("../connection/manager");
|
|
9
|
+
/**
|
|
10
|
+
* Argos-JS Transactional SQL Migration Engine
|
|
11
|
+
*
|
|
12
|
+
* Handles creation of the internal _argos_migrations tracking table,
|
|
13
|
+
* executes pending migrations in transactions, tracks batches, provides rollbacks,
|
|
14
|
+
* and reports detailed migration status.
|
|
15
|
+
*/
|
|
16
|
+
class Migrator {
|
|
17
|
+
db;
|
|
18
|
+
migrationsDir;
|
|
19
|
+
customLoader;
|
|
20
|
+
constructor(dbOrConnection, options) {
|
|
21
|
+
if (typeof dbOrConnection === 'string') {
|
|
22
|
+
this.db = manager_1.databaseManager.connection(dbOrConnection);
|
|
23
|
+
}
|
|
24
|
+
else if (dbOrConnection) {
|
|
25
|
+
this.db = dbOrConnection;
|
|
26
|
+
}
|
|
27
|
+
else if (options?.connection) {
|
|
28
|
+
this.db = manager_1.databaseManager.connection(options.connection);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.db = manager_1.databaseManager.connection();
|
|
32
|
+
}
|
|
33
|
+
this.migrationsDir = options?.migrationsDir
|
|
34
|
+
? (0, node_path_1.resolve)(process.cwd(), options.migrationsDir)
|
|
35
|
+
: (0, node_path_1.resolve)(process.cwd(), 'app/database/migrations');
|
|
36
|
+
this.customLoader = options?.loader;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Formats parameter placeholders across database drivers ($1 for pg, ? for others).
|
|
40
|
+
*/
|
|
41
|
+
formatQuery(sql) {
|
|
42
|
+
const driver = this.db.driverName;
|
|
43
|
+
if (driver.includes('postgres') || driver === 'pg') {
|
|
44
|
+
let index = 1;
|
|
45
|
+
return sql.replace(/\?/g, () => `$${index++}`);
|
|
46
|
+
}
|
|
47
|
+
return sql;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Ensures the internal _argos_migrations table exists in the connected database.
|
|
51
|
+
*/
|
|
52
|
+
async ensureMigrationsTable() {
|
|
53
|
+
const driver = this.db.driverName;
|
|
54
|
+
let ddl;
|
|
55
|
+
if (driver.includes('postgres') || driver === 'pg') {
|
|
56
|
+
ddl = `
|
|
57
|
+
CREATE TABLE IF NOT EXISTS _argos_migrations (
|
|
58
|
+
id SERIAL PRIMARY KEY,
|
|
59
|
+
name VARCHAR(255) NOT NULL UNIQUE,
|
|
60
|
+
batch INTEGER NOT NULL,
|
|
61
|
+
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
62
|
+
);
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
else if (driver.includes('mysql')) {
|
|
66
|
+
ddl = `
|
|
67
|
+
CREATE TABLE IF NOT EXISTS _argos_migrations (
|
|
68
|
+
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
69
|
+
name VARCHAR(255) NOT NULL UNIQUE,
|
|
70
|
+
batch INT NOT NULL,
|
|
71
|
+
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
72
|
+
);
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// SQLite
|
|
77
|
+
ddl = `
|
|
78
|
+
CREATE TABLE IF NOT EXISTS _argos_migrations (
|
|
79
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
80
|
+
name TEXT NOT NULL UNIQUE,
|
|
81
|
+
batch INTEGER NOT NULL,
|
|
82
|
+
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
83
|
+
);
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
await this.db.execute(ddl);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns all executed migration records from _argos_migrations ordered by id ASC.
|
|
90
|
+
*/
|
|
91
|
+
async getExecutedMigrations() {
|
|
92
|
+
await this.ensureMigrationsTable();
|
|
93
|
+
const query = 'SELECT id, name, batch, executed_at FROM _argos_migrations ORDER BY id ASC';
|
|
94
|
+
const res = await this.db.execute(query);
|
|
95
|
+
return res.rows;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Scans migrations directory for all migration files (*.ts, *.js), sorted lexicographically.
|
|
99
|
+
*/
|
|
100
|
+
getMigrationFiles() {
|
|
101
|
+
if (!(0, node_fs_1.existsSync)(this.migrationsDir)) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const files = (0, node_fs_1.readdirSync)(this.migrationsDir)
|
|
105
|
+
.filter((f) => (f.endsWith('.ts') || f.endsWith('.js')) &&
|
|
106
|
+
!f.endsWith('.d.ts') &&
|
|
107
|
+
!f.endsWith('.map'))
|
|
108
|
+
.sort();
|
|
109
|
+
return files.map((file) => ({
|
|
110
|
+
name: file.replace(/\.(ts|js)$/, ''),
|
|
111
|
+
fullPath: (0, node_path_1.resolve)(this.migrationsDir, file),
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns files that have not yet been executed in _argos_migrations.
|
|
116
|
+
*/
|
|
117
|
+
async getPendingMigrations() {
|
|
118
|
+
const executed = await this.getExecutedMigrations();
|
|
119
|
+
const executedNames = new Set(executed.map((m) => m.name));
|
|
120
|
+
const allFiles = this.getMigrationFiles();
|
|
121
|
+
return allFiles.filter((f) => !executedNames.has(f.name));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns the current maximum batch number (or 0 if no migrations have been executed).
|
|
125
|
+
*/
|
|
126
|
+
async getCurrentBatch() {
|
|
127
|
+
await this.ensureMigrationsTable();
|
|
128
|
+
const query = 'SELECT MAX(batch) as max_batch FROM _argos_migrations';
|
|
129
|
+
const res = await this.db.execute(query);
|
|
130
|
+
const row = res.rows[0];
|
|
131
|
+
return row && row.max_batch ? Number(row.max_batch) : 0;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Official migration runner.
|
|
135
|
+
* Executes all pending migrations in chronological order within a transaction per migration,
|
|
136
|
+
* tracking batch and execution duration.
|
|
137
|
+
*/
|
|
138
|
+
async runPendingMigrations() {
|
|
139
|
+
await this.ensureMigrationsTable();
|
|
140
|
+
const pending = await this.getPendingMigrations();
|
|
141
|
+
if (pending.length === 0) {
|
|
142
|
+
const currentBatch = await this.getCurrentBatch();
|
|
143
|
+
return { migrated: [], batch: currentBatch, steps: [] };
|
|
144
|
+
}
|
|
145
|
+
const currentBatch = await this.getCurrentBatch();
|
|
146
|
+
const nextBatch = currentBatch + 1;
|
|
147
|
+
const migrated = [];
|
|
148
|
+
const steps = [];
|
|
149
|
+
for (const migration of pending) {
|
|
150
|
+
const mod = await this.loadMigration(migration.fullPath);
|
|
151
|
+
if (typeof mod.up !== 'function') {
|
|
152
|
+
throw new Error(`Migration "${migration.name}" does not export an async up(db) function.`);
|
|
153
|
+
}
|
|
154
|
+
const start = performance.now();
|
|
155
|
+
await this.db.transaction(async (trx) => {
|
|
156
|
+
const schema = new schema_builder_1.SchemaBuilder(trx);
|
|
157
|
+
const context = Object.assign(Object.create(trx), {
|
|
158
|
+
db: trx,
|
|
159
|
+
schema,
|
|
160
|
+
});
|
|
161
|
+
await mod.up(context);
|
|
162
|
+
const insertSql = this.formatQuery('INSERT INTO _argos_migrations (name, batch, executed_at) VALUES (?, ?, CURRENT_TIMESTAMP)');
|
|
163
|
+
await trx.execute(insertSql, [migration.name, nextBatch]);
|
|
164
|
+
});
|
|
165
|
+
const durationMs = Math.round(performance.now() - start);
|
|
166
|
+
migrated.push(migration.name);
|
|
167
|
+
steps.push({ name: migration.name, durationMs });
|
|
168
|
+
}
|
|
169
|
+
return { migrated, batch: nextBatch, steps };
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Transparent alias for runPendingMigrations().
|
|
173
|
+
*/
|
|
174
|
+
async migrate() {
|
|
175
|
+
return this.runPendingMigrations();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Official rollback runner.
|
|
179
|
+
* Reverts all migrations executed in the latest batch in reverse chronological order.
|
|
180
|
+
*/
|
|
181
|
+
async rollbackLastBatch() {
|
|
182
|
+
await this.ensureMigrationsTable();
|
|
183
|
+
const lastBatch = await this.getCurrentBatch();
|
|
184
|
+
if (lastBatch <= 0) {
|
|
185
|
+
return { rolledBack: [], batch: 0, steps: [] };
|
|
186
|
+
}
|
|
187
|
+
const selectSql = this.formatQuery('SELECT id, name, batch FROM _argos_migrations WHERE batch = ? ORDER BY id DESC');
|
|
188
|
+
const res = await this.db.execute(selectSql, [lastBatch]);
|
|
189
|
+
const toRollback = res.rows;
|
|
190
|
+
if (toRollback.length === 0) {
|
|
191
|
+
return { rolledBack: [], batch: lastBatch, steps: [] };
|
|
192
|
+
}
|
|
193
|
+
const allFiles = this.getMigrationFiles();
|
|
194
|
+
const fileMap = new Map(allFiles.map((f) => [f.name, f.fullPath]));
|
|
195
|
+
const rolledBack = [];
|
|
196
|
+
const steps = [];
|
|
197
|
+
for (const record of toRollback) {
|
|
198
|
+
const fullPath = fileMap.get(record.name);
|
|
199
|
+
if (!fullPath) {
|
|
200
|
+
throw new Error(`Migration file for "${record.name}" not found in migrations directory: ${this.migrationsDir}`);
|
|
201
|
+
}
|
|
202
|
+
const mod = await this.loadMigration(fullPath);
|
|
203
|
+
if (typeof mod.down !== 'function') {
|
|
204
|
+
throw new Error(`Migration "${record.name}" does not export an async down(db) function.`);
|
|
205
|
+
}
|
|
206
|
+
const start = performance.now();
|
|
207
|
+
await this.db.transaction(async (trx) => {
|
|
208
|
+
const schema = new schema_builder_1.SchemaBuilder(trx);
|
|
209
|
+
const context = Object.assign(Object.create(trx), {
|
|
210
|
+
db: trx,
|
|
211
|
+
schema,
|
|
212
|
+
});
|
|
213
|
+
await mod.down(context);
|
|
214
|
+
const deleteSql = this.formatQuery('DELETE FROM _argos_migrations WHERE name = ?');
|
|
215
|
+
await trx.execute(deleteSql, [record.name]);
|
|
216
|
+
});
|
|
217
|
+
const durationMs = Math.round(performance.now() - start);
|
|
218
|
+
rolledBack.push(record.name);
|
|
219
|
+
steps.push({ name: record.name, durationMs });
|
|
220
|
+
}
|
|
221
|
+
return { rolledBack, batch: lastBatch, steps };
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Transparent alias for rollbackLastBatch().
|
|
225
|
+
*/
|
|
226
|
+
async rollback() {
|
|
227
|
+
return this.rollbackLastBatch();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Returns a complete list of all local migrations with their status (applied | pending),
|
|
231
|
+
* associated batch number, and execution timestamp.
|
|
232
|
+
*/
|
|
233
|
+
async getMigrationStatus() {
|
|
234
|
+
await this.ensureMigrationsTable();
|
|
235
|
+
const executed = await this.getExecutedMigrations();
|
|
236
|
+
const executedMap = new Map(executed.map((m) => [m.name, m]));
|
|
237
|
+
const allFiles = this.getMigrationFiles();
|
|
238
|
+
return allFiles.map((file) => {
|
|
239
|
+
const rec = executedMap.get(file.name);
|
|
240
|
+
if (rec) {
|
|
241
|
+
return {
|
|
242
|
+
name: file.name,
|
|
243
|
+
status: 'applied',
|
|
244
|
+
batch: rec.batch,
|
|
245
|
+
executed_at: rec.executed_at,
|
|
246
|
+
fullPath: file.fullPath,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
name: file.name,
|
|
251
|
+
status: 'pending',
|
|
252
|
+
batch: null,
|
|
253
|
+
executed_at: null,
|
|
254
|
+
fullPath: file.fullPath,
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Loads a migration module dynamically.
|
|
260
|
+
*/
|
|
261
|
+
async loadMigration(fullPath) {
|
|
262
|
+
if (this.customLoader) {
|
|
263
|
+
return await this.customLoader(fullPath);
|
|
264
|
+
}
|
|
265
|
+
const fileUrl = (0, node_url_1.pathToFileURL)(fullPath).href;
|
|
266
|
+
const mod = await import(fileUrl);
|
|
267
|
+
return {
|
|
268
|
+
up: mod.up ?? mod.default?.up,
|
|
269
|
+
down: mod.down ?? mod.default?.down,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.Migrator = Migrator;
|
|
274
|
+
//# sourceMappingURL=migrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrator.js","sourceRoot":"","sources":["../../src/migrations/migrator.ts"],"names":[],"mappings":";;;AAAA,qCAAkD;AAClD,yCAAoC;AACpC,uCAAyC;AAUzC,qDAAwE;AACxE,mDAAwD;AAQxD;;;;;;GAMG;AACH,MAAa,QAAQ;IACX,EAAE,CAAiB;IACnB,aAAa,CAAS;IACtB,YAAY,CAAgE;IAEpF,YAAY,cAAwC,EAAE,OAAyB;QAC7E,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC,EAAE,GAAG,yBAAe,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACvD,CAAC;aAAM,IAAI,cAAc,EAAE,CAAC;YAC1B,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC;QAC3B,CAAC;aAAM,IAAI,OAAO,EAAE,UAAU,EAAE,CAAC;YAC/B,IAAI,CAAC,EAAE,GAAG,yBAAe,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,EAAE,GAAG,yBAAe,CAAC,UAAU,EAAE,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,OAAO,EAAE,aAAa;YACzC,CAAC,CAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,aAAa,CAAC;YAC/C,CAAC,CAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,yBAAyB,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,MAAM,CAAC;IACtC,CAAC;IAED;;OAEG;IACK,WAAW,CAAC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