Debug splitting normal and metrics tables

This commit is contained in:
2025-01-11 17:53:08 -05:00
parent 50ead64356
commit 1eccfe0b2c
7 changed files with 325 additions and 337 deletions

View File

@@ -67,19 +67,28 @@ async function resetDatabase() {
await connection.query('SET FOREIGN_KEY_CHECKS = 1');
}
// Read and execute schema directly instead of spawning a process
// Read and execute main schema
outputProgress({
operation: 'Running database setup',
message: 'Creating new tables...'
message: 'Creating core tables...'
});
const schemaSQL = fs.readFileSync(path.join(__dirname, '../db/schema.sql'), 'utf8');
await connection.query(schemaSQL);
// Read and execute metrics schema
outputProgress({
operation: 'Running metrics setup',
message: 'Creating metrics tables...'
});
const metricsSchemaSQL = fs.readFileSync(path.join(__dirname, '../db/metrics-schema.sql'), 'utf8');
await connection.query(metricsSchemaSQL);
outputProgress({
status: 'complete',
operation: 'Database reset complete',
message: 'Database has been reset and tables recreated'
message: 'Database has been reset and all tables recreated'
});
} catch (error) {
outputProgress({