From daad593bcc2507e9a4992a5ab9350e446d88a99a Mon Sep 17 00:00:00 2001 From: Stephen Romansky Date: Thu, 18 Dec 2014 13:35:46 -0700 Subject: [PATCH] Added outline of new database scheme and TODO list to implement it Related #667 Related #484 Related #671 --- src/freeseer/framework/database.py | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/freeseer/framework/database.py b/src/freeseer/framework/database.py index 57d17ed8..67ff29e5 100644 --- a/src/freeseer/framework/database.py +++ b/src/freeseer/framework/database.py @@ -49,6 +49,8 @@ Time timestamp, UNIQUE (Speaker, Title) ON CONFLICT IGNORE)''' +# The SQLITE timestamp field corresponds to the DateTime object. The Date column in the database can be created from +# a DateTime.date() call. PRESENTATIONS_SCHEMA_310 = '''CREATE TABLE IF NOT EXISTS presentations (Id INTEGER PRIMARY KEY, Title varchar(255), @@ -62,6 +64,32 @@ EndTime timestamp, UNIQUE (Speaker, Title) ON CONFLICT IGNORE)''' +# TODO: Make PRESENTATIONS_SCHEMA_315 the default schema when the presentation table is created +# TODO: Make an upgrade method from PRESENTATIONS_SCHEMA_310 to PRESENTATIONS_SCHEMA_315 +# TODO: Update the SCHEMA_VERSION to 315 +# TODO: Integrate new database scheme with importers/exporter functions +# TODO: Force Presentation.Date to be a QDate +# TODO: Figure out what the types should be for Presentation.StartTime/EndTime e.g. QTime +# TODO: Enforce the default database values in the CSV/RSS importer +# TODO: Enforce the default database values in Presentation.__init__ +# TODO: Enforce the default database values in db.insert_presentation() +# TODO: Check what format the csv and rss sample files are in. For instance, do the rss files use 'None' instead of '' +# for missing fields? +# TODO: Update _helper_presentation_exists() and get_presentation_id() to use the new schema such that they no longer +# check if the stored data values are NULL +PRESENTATIONS_SCHEMA_315 = '''CREATE TABLE IF NOT EXISTS presentations + (Id INTEGER PRIMARY KEY, + Title varchar(255) NOT NULL DEFAULT '', + Speaker varchar(100) NOT NULL DEFAULT '', + Description text NOT NULL DEFAULT '', + Category varchar(25) NOT NULL DEFAULT '', + Event varchar(100) NOT NULL DEFAULT '', + Room varchar(25) NOT NULL DEFAULT '', + Date timestamp NOT NULL DEFAULT '', + StartTime timestamp NOT NULL DEFAULT '', + EndTime timestamp NOT NULL DEFAULT '', + UNIQUE (Speaker, Title, Event) ON CONFLICT IGNORE)''' + REPORTS_SCHEMA_300 = '''CREATE TABLE IF NOT EXISTS failures (Id INTERGER PRIMARY KEY, Comments TEXT, @@ -69,6 +97,10 @@ Release INTEGER, UNIQUE (ID) ON CONFLICT REPLACE)''' +# TODO: Ensure that the CSV/RSS to presentation importers are done using the same conventions. For instance, convert a +# room with value None to '' in both the csv and rss importer. Instead of the csv parser converting None to 'None' +# and the rss importer doing something else etcetera. + class QtDBConnector(object): def __init__(self, db_filepath, plugman):