billreminder r650 - in trunk: . src/db src/lib



Author: ogmaciel
Date: Thu Sep 25 21:56:17 2008
New Revision: 650
URL: http://svn.gnome.org/viewvc/billreminder?rev=650&view=rev

Log:
Make amountDue an optional field in the DB; validating that db upgrade routine works. More to come.

Modified:
   trunk/ChangeLog
   trunk/src/db/billstable.py
   trunk/src/lib/dal.py

Modified: trunk/src/db/billstable.py
==============================================================================
--- trunk/src/db/billstable.py	(original)
+++ trunk/src/db/billstable.py	Thu Sep 25 21:56:17 2008
@@ -6,7 +6,7 @@
 
 class BillsTable(GenericTable):
     """ Table to hold information for all bills created. """
-    Version = 3
+    Version = 4
     Key = "Id"
     KeyAuto = True
     Name = "br_BillsTable"
@@ -16,7 +16,7 @@
             catId INTEGER,
             payee TEXT NOT NULL,
             dueDate INTEGER NOT NULL,
-            amountDue INTEGER NOT NULL,
+            amountDue INTEGER,
             notes TEXT,
             paid INTEGER DEFAULT 0,
             alarm INTEGER)

Modified: trunk/src/lib/dal.py
==============================================================================
--- trunk/src/lib/dal.py	(original)
+++ trunk/src/lib/dal.py	Thu Sep 25 21:56:17 2008
@@ -83,6 +83,7 @@
 
     def _validate_tables(self):
         """ Validates that all tables are up to date. """
+        print "Got here"
         stmt = "select tbl_name from sqlite_master where " \
                "type = 'table' and tbl_name like 'br_%'"
         self.cur.execute(stmt)
@@ -105,14 +106,14 @@
             except:
                 ver = -1
             # Table is obsolete and will be deleted
-            if tblname not in self._tables:
+            if tblname not in self._tables.keys():
                 # We should revisit this logic
                 print '%s is an obsolete table and it will be deleted' % \
                        tblname
                 self._delete_table(tblname)
                 continue
             if self._tables[tblname].Version != int(ver) :
-                print '%s is NOT a valid table' % tblname
+                print '%s is outdated and will be updated!' % tblname
                 self._update_table(self._tables[tblname])
                 # Save tables version info
                 self._update_table_version(self._tables[tblname])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]