@xenon-device-management/xenon 1.1.27 → 1.1.28
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/package.json
CHANGED
|
@@ -94,16 +94,19 @@ function runMigrations() {
|
|
|
94
94
|
const dbDir = path.dirname(config_1.config.databasePath || path.join(os.homedir(), '.cache', 'xenon', 'xenon.db'));
|
|
95
95
|
fs.mkdirSync(dbDir, { recursive: true });
|
|
96
96
|
const { cmd, prefix } = resolvePrismaInvocation(rootDir);
|
|
97
|
-
const args = [...prefix, 'migrate', 'deploy', '--schema', schemaPath];
|
|
98
97
|
const env = Object.assign(Object.assign({}, process.env), { DATABASE_URL: config_1.config.databaseUrl });
|
|
98
|
+
const isSqlite = config_1.config.databaseProvider === 'sqlite';
|
|
99
|
+
const args = isSqlite
|
|
100
|
+
? [...prefix, 'db', 'push', '--skip-generate', '--accept-data-loss', '--schema', schemaPath]
|
|
101
|
+
: [...prefix, 'migrate', 'deploy', '--schema', schemaPath];
|
|
99
102
|
try {
|
|
100
|
-
logger_1.default.info(`[DBMigrate]
|
|
103
|
+
logger_1.default.info(`[DBMigrate] Syncing database schema (${config_1.config.databaseProvider}, ${isSqlite ? 'db push' : 'migrate deploy'})...`);
|
|
101
104
|
(0, node_child_process_1.execFileSync)(cmd, args, { env, cwd: rootDir, stdio: 'pipe' });
|
|
102
|
-
logger_1.default.info('[DBMigrate]
|
|
105
|
+
logger_1.default.info('[DBMigrate] Database schema in sync.');
|
|
103
106
|
}
|
|
104
107
|
catch (err) {
|
|
105
108
|
const msg = ((_a = err === null || err === void 0 ? void 0 : err.stderr) === null || _a === void 0 ? void 0 : _a.toString()) || (err === null || err === void 0 ? void 0 : err.message) || String(err);
|
|
106
|
-
logger_1.default.error(`[DBMigrate] Auto-
|
|
109
|
+
logger_1.default.error(`[DBMigrate] Auto-sync failed: ${msg}`);
|
|
107
110
|
}
|
|
108
111
|
});
|
|
109
112
|
}
|
package/package.json
CHANGED