[hamster-applet] bug 609682 - using autoincrement to avoid recycling fact IDs
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] bug 609682 - using autoincrement to avoid recycling fact IDs
- Date: Fri, 12 Feb 2010 10:42:25 +0000 (UTC)
commit 6f0e87ce8908e92ba4cb70ff6575c2a1df5b1914
Author: Toms Bauģis <toms baugis gmail com>
Date: Fri Feb 12 10:41:46 2010 +0000
bug 609682 - using autoincrement to avoid recycling fact IDs
src/hamster/db.py | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/hamster/db.py b/src/hamster/db.py
index 7701a86..fb01c47 100644
--- a/src/hamster/db.py
+++ b/src/hamster/db.py
@@ -928,7 +928,7 @@ class Storage(storage.Storage):
"""upgrade DB to hamster version"""
version = self.fetchone("SELECT version FROM version")["version"]
- current_version = 6
+ current_version = 7
if version < 2:
"""moving from fact_date, fact_time to start_time, end_time"""
@@ -1108,6 +1108,19 @@ class Storage(storage.Storage):
self.execute("CREATE INDEX idx_fact_tags_fact ON fact_tags(fact_id)")
self.execute("CREATE INDEX idx_fact_tags_tag ON fact_tags(tag_id)")
+
+ if version < 7:
+ self.execute("""CREATE TABLE increment_facts (id integer primary key autoincrement,
+ activity_id integer,
+ start_time timestamp,
+ end_time timestamp,
+ description varchar2)""")
+ self.execute("""INSERT INTO increment_facts(id, activity_id, start_time, end_time, description)
+ SELECT id, activity_id, start_time, end_time, description from facts""")
+ self.execute("DROP table facts")
+ self.execute("ALTER TABLE increment_facts RENAME TO facts")
+
+
# at the happy end, update version number
if version < current_version:
#lock down current version
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]