Move middleware sources into core/, refresh config paths, and update design/user docs to reflect the raw payload pipeline.
24 lines
602 B
JavaScript
24 lines
602 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const DatabaseClient = require('../queue/db');
|
|
const config = require('../config/config');
|
|
|
|
async function migrate() {
|
|
const db = new DatabaseClient(config.db);
|
|
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
const payload = fs.readFileSync(schemaPath, 'utf8');
|
|
await db.exec(payload);
|
|
await db.close();
|
|
}
|
|
|
|
if (require.main === module) {
|
|
migrate()
|
|
.then(() => console.log('migrations applied'))
|
|
.catch((err) => {
|
|
console.error('migration failed', err);
|
|
process.exit(1);
|
|
});
|
|
}
|
|
|
|
module.exports = migrate;
|