-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase-setup.js
More file actions
33 lines (26 loc) · 870 Bytes
/
database-setup.js
File metadata and controls
33 lines (26 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const low = require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');
const path = require('path');
// Create database file path
const dbPath = path.join(__dirname, 'content-aggregator.json');
const adapter = new FileSync(dbPath);
const db = low(adapter);
console.log('Setting up database...');
// Initialize database structure
db.defaults({
feeds: [],
articles: [],
metadata: {
created: new Date().toISOString(),
lastUpdate: new Date().toISOString()
}
}).write();
console.log('✓ Database structure created');
console.log(`✓ Database file: ${dbPath}`);
// Get stats
const feedCount = db.get('feeds').size().value();
const articleCount = db.get('articles').size().value();
console.log(`\nCurrent Stats:`);
console.log(` Feeds: ${feedCount}`);
console.log(` Articles: ${articleCount}`);
console.log('\nDatabase setup complete!');