MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / parseSearchUnary

Function parseSearchUnary

main.js:3409–3421  ·  view source on GitHub ↗
(tokens, i, params, filters)

Source from the content-addressed store, hash-verified

3407 // Check if dateAdded column exists
3408 const tableInfo = db.prepare("PRAGMA table_info(models)").all();
3409 const hasDateAdded = tableInfo.some(col => col.name === 'dateAdded');
3410
3411 if (!hasDateAdded) {
3412 console.log('dateAdded column not found. Adding it...');
3413
3414 // Add the column
3415 db.prepare('ALTER TABLE models ADD COLUMN dateAdded DATETIME').run();
3416
3417 // For existing records, set dateAdded = modifiedDate as fallback, or current timestamp if modifiedDate is null
3418 db.prepare(`
3419 UPDATE models
3420 SET dateAdded = COALESCE(modifiedDate, datetime('now'))
3421 WHERE dateAdded IS NULL
3422 `).run();
3423
3424 console.log('dateAdded column added and existing records updated');

Callers 1

parseSearchAndFunction · 0.85

Calls 1

parseSearchPrimaryFunction · 0.85

Tested by

no test coverage detected