Release v2.6.20
This commit is contained in:
+10
-2
@@ -1,3 +1,6 @@
|
||||
const { version: appVersion } = require('#root/package.json');
|
||||
const { compareVersions, detectSchemaVersion, recordSchemaVersion, runMigrations } = require('./migrations');
|
||||
|
||||
// Snapshot only: keep this file aligned with the current schema state.
|
||||
async function ensureSchema(pool, options) {
|
||||
const schemaLockName = 'pulse_signage_schema_lock';
|
||||
@@ -12,6 +15,11 @@ async function ensureSchema(pool, options) {
|
||||
}
|
||||
|
||||
try {
|
||||
const currentVersion = await detectSchemaVersion(pool);
|
||||
const updateRequired = compareVersions(currentVersion, appVersion) < 0;
|
||||
|
||||
console.info('[schema] previous=' + currentVersion + ' current=' + appVersion + ' update=' + (updateRequired ? 'yes' : 'no'));
|
||||
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS c_canvas_sizes (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -384,8 +392,8 @@ async function ensureSchema(pool, options) {
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
|
||||
const { runMigrations } = require('./migrations');
|
||||
await runMigrations(pool, options);
|
||||
await runMigrations(pool, Object.assign({}, options, { currentVersion: currentVersion }));
|
||||
await recordSchemaVersion(pool, appVersion);
|
||||
} finally {
|
||||
await pool.query('SELECT RELEASE_LOCK(?)', [schemaLockName]).catch(function () {
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user