Migrate architecture to PostgreSQL for Swarm HA

This commit is contained in:
ypratama committed 2026-08-12 14:32:00 +07:00
1 parent ee28968a70
commit 2317f9f133
39 files changed
+3849 -10

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
const { DatabaseSync } = require('node:sqlite');
const db = new DatabaseSync('dev.db');
try {
// 1. Delete all ApprovalLogs
db.exec('DELETE FROM ApprovalLog');
console.log('Cleared all ApprovalLogs');
// 2. Delete all Requests
db.exec('DELETE FROM Request');
console.log('Cleared all Requests');
// 3. Delete ActivityLogs
db.exec('DELETE FROM ActivityLog');
console.log('Cleared all ActivityLogs');
// 4. Reset all Item quantities to 0
db.exec('UPDATE Item SET totalQuantity = 0, borrowedQty = 0, trialQty = 0, billedQty = 0, availableQty = 0, damagedQty = 0, soldQty = 0');
console.log('Reset all item quantities to 0');
console.log('Done!');
} catch (err) {
console.error('Error:', err);
} finally {
db.close();
}