File size: 488 Bytes
8f096b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Dexie from 'dexie';

export const db = new Dexie('ServiceBookDB');

db.version(1).stores({
  transactions: '++id, userId, date, type, category, amount',
  syncQueue: '++id, action, payload, timestamp',
  settings: 'key'
});

db.version(2).upgrade(trans => {
  return trans.table('transactions').toCollection().modify(transaction => {
    transaction.synced = false;
    transaction.updatedAt = new Date().toISOString();
  });
});

// Export the database instance
export default db;