MCPcopy Create free account
hub / github.com/Sagyam/linite / wipeDatabase

Function wipeDatabase

scripts/wipe-db.ts:44–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44async function wipeDatabase() {
45 // Skip Azure Blob Storage wipe to save costs - images will be reused
46 //await wipeAzureBlobs();
47
48 console.log('🗑️ Wiping database (keeping Azure Blob Storage images)...');
49
50 try {
51 // Get all table names
52 const tables = [
53 'distro_sources',
54 'packages',
55 'apps',
56 'sources',
57 'distros',
58 'categories',
59 'verification',
60 'account',
61 'session',
62 'user',
63 ];
64
65 // Delete all data from tables in reverse order (to respect foreign keys)
66 for (const table of tables) {
67 await db.run(sql.raw(`DELETE FROM ${table}`));
68 console.log(` ✓ Cleared ${table}`);
69 }
70
71 console.log('✅ Database wiped successfully!');
72 console.log('💡 Run "bun run db:seed" to populate with initial data');
73 } catch (error) {
74 console.error('❌ Failed to wipe database:', error);
75 process.exit(1);
76 }
77
78 process.exit(0);
79}
80
81wipeDatabase();

Callers 1

wipe-db.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected