Add PainterPalette integration, canonical DB schema, and influence UI fixes.
Integrate Inputs/PainterPalette.csv for artist metadata and influence links, add db/schema.sql with server/migrate.js, letterbox influence panel thumbnails, and refresh Titian/Pontormo images. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
4eead54062
commit
b2cae284ac
@@ -0,0 +1,45 @@
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const pool = require('./db');
|
||||
|
||||
const INCREMENTAL_MIGRATIONS = [
|
||||
'migrate-checkup-flags.sql',
|
||||
'migrate-artist-checkup-flags.sql',
|
||||
'migrate-influence-sources.sql',
|
||||
'migrate-painting-annotations.sql',
|
||||
'migrate-artist-palette.sql',
|
||||
];
|
||||
|
||||
async function applySqlFile(label, filePath) {
|
||||
const sql = fs.readFileSync(filePath, 'utf8');
|
||||
await pool.query(sql);
|
||||
console.log(` ${label}`);
|
||||
}
|
||||
|
||||
async function migrate() {
|
||||
const dbDir = path.join(__dirname, '..', 'db');
|
||||
const schemaPath = path.join(dbDir, 'schema.sql');
|
||||
|
||||
console.log('Applying db/schema.sql …');
|
||||
await applySqlFile('schema.sql', schemaPath);
|
||||
|
||||
console.log('Applying incremental migrations …');
|
||||
for (const file of INCREMENTAL_MIGRATIONS) {
|
||||
const filePath = path.join(dbDir, file);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.warn(` skipped (missing): ${file}`);
|
||||
continue;
|
||||
}
|
||||
await applySqlFile(file, filePath);
|
||||
}
|
||||
|
||||
console.log('Database migration complete.');
|
||||
}
|
||||
|
||||
migrate()
|
||||
.then(() => pool.end())
|
||||
.catch((err) => {
|
||||
console.error('Migration failed:', err.message);
|
||||
pool.end().finally(() => process.exit(1));
|
||||
});
|
||||
Reference in New Issue
Block a user