Commit e969a43f authored by Og B. Maciel's avatar Og B. Maciel

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

svn path=/trunk/; revision=650
parent 72c8cde8
2008-09-25 Og Maciel <ogmaciel@gnome.org>
* src/db/billstable.py: Bump version and make amountDue optional.
* src/lib/dal.py: Validating that the tables update routine does its job.
2008-09-24 Og Maciel <ogmaciel@gnome.org>
* src/gui/widgets/calendarwidget.py: Added mnemonics.
......
......@@ -6,7 +6,7 @@ from generictable import GenericTable
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 @@ class BillsTable(GenericTable):
catId INTEGER,
payee TEXT NOT NULL,
dueDate INTEGER NOT NULL,
amountDue INTEGER NOT NULL,
amountDue INTEGER,
notes TEXT,
paid INTEGER DEFAULT 0,
alarm INTEGER)
......
......@@ -83,6 +83,7 @@ class DAL(object):
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 @@ class DAL(object):
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])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment