masterrecord 0.3.54 → 0.3.56
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/Migrations/cli.js +18 -3
- package/Migrations/schema.js +3 -1
- package/mySQLConnect.js +2 -0
- package/package.json +1 -1
package/Migrations/cli.js
CHANGED
|
@@ -119,7 +119,12 @@ program.option('-V', 'output the version');
|
|
|
119
119
|
}
|
|
120
120
|
const snapDir = path.dirname(file);
|
|
121
121
|
const contextAbs = path.resolve(snapDir, contextSnapshot.contextLocation || '');
|
|
122
|
-
|
|
122
|
+
let migBase = path.resolve(snapDir, contextSnapshot.migrationFolder || '.');
|
|
123
|
+
if (!fs.existsSync(migBase)) {
|
|
124
|
+
console.warn(`⚠️ Resolved migration path does not exist: ${migBase}`);
|
|
125
|
+
console.warn(` Falling back to snapshot directory: ${snapDir}`);
|
|
126
|
+
migBase = snapDir;
|
|
127
|
+
}
|
|
123
128
|
// Find latest migration file (so we can use its class which extends schema)
|
|
124
129
|
var migrationFiles = globSearch.sync(`**/*_migration.js`, { cwd: migBase, dot: true, windowsPathsNoEscape: true });
|
|
125
130
|
migrationFiles = (migrationFiles || []).map(f => path.resolve(migBase, f));
|
|
@@ -242,7 +247,12 @@ program.option('-V', 'output the version');
|
|
|
242
247
|
// Resolve relative paths from the snapshot directory (portable snapshots)
|
|
243
248
|
const snapDir = path.dirname(file);
|
|
244
249
|
const contextAbs = path.resolve(snapDir, contextSnapshot.contextLocation || '');
|
|
245
|
-
|
|
250
|
+
let migBase = path.resolve(snapDir, contextSnapshot.migrationFolder || '.');
|
|
251
|
+
if (!fs.existsSync(migBase)) {
|
|
252
|
+
console.warn(`⚠️ Resolved migration path does not exist: ${migBase}`);
|
|
253
|
+
console.warn(` Falling back to snapshot directory: ${snapDir}`);
|
|
254
|
+
migBase = snapDir;
|
|
255
|
+
}
|
|
246
256
|
|
|
247
257
|
let ContextCtor;
|
|
248
258
|
try{
|
|
@@ -345,7 +355,12 @@ program.option('-V', 'output the version');
|
|
|
345
355
|
|
|
346
356
|
const snapDir = path.dirname(file);
|
|
347
357
|
const contextAbs = path.resolve(snapDir, contextSnapshot.contextLocation || '');
|
|
348
|
-
|
|
358
|
+
let migBase = path.resolve(snapDir, contextSnapshot.migrationFolder || '.');
|
|
359
|
+
if (!fs.existsSync(migBase)) {
|
|
360
|
+
console.warn(`⚠️ Resolved migration path does not exist: ${migBase}`);
|
|
361
|
+
console.warn(` Falling back to snapshot directory: ${snapDir}`);
|
|
362
|
+
migBase = snapDir;
|
|
363
|
+
}
|
|
349
364
|
|
|
350
365
|
console.log(`\n🔍 Searching for migration files in: ${migBase}`);
|
|
351
366
|
var migrationFiles = globSearch.sync(`**/*_migration.js`, { cwd: migBase, dot: true, windowsPathsNoEscape: true });
|
package/Migrations/schema.js
CHANGED
|
@@ -154,6 +154,7 @@ class schema{
|
|
|
154
154
|
await this._ensureReady();
|
|
155
155
|
if(table){
|
|
156
156
|
this.fullTable = table.___table;
|
|
157
|
+
this._tableObj = table;
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
|
@@ -490,7 +491,8 @@ class schema{
|
|
|
490
491
|
if(this.context.isSQLite){
|
|
491
492
|
var sqliteQuery = require("./migrationSQLiteQuery");
|
|
492
493
|
var queryBuilder = new sqliteQuery();
|
|
493
|
-
var
|
|
494
|
+
var tableSchema = (this._tableObj && this._tableObj[table.tableName]) || this.fullTable.new;
|
|
495
|
+
var queryObj = queryBuilder.alterColumn(tableSchema, table);
|
|
494
496
|
for (var key in queryObj) {
|
|
495
497
|
var query = queryObj[key];
|
|
496
498
|
await this.context._execute(query);
|
package/mySQLConnect.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "masterrecord",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.56",
|
|
4
4
|
"description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
|
|
5
5
|
"main": "MasterRecord.js",
|
|
6
6
|
"bin": {
|