summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-09-10 14:46:26 -0400
committerWill Woods <wwoods@redhat.com>2009-09-10 14:46:26 -0400
commit142e0c1edca47620a065501c6a93903bdc1e08f2 (patch)
tree18c29f5dfc45e0f45914e06562a3d307d913ecba
parent0937073f789795f227112257254dff6c205ab77f (diff)
downloadisrawhidebroken-142e0c1edca47620a065501c6a93903bdc1e08f2.tar.gz
israwhidebroken-142e0c1edca47620a065501c6a93903bdc1e08f2.tar.xz
israwhidebroken-142e0c1edca47620a065501c6a93903bdc1e08f2.zip
First draft of the israwhidebroken model
-rw-r--r--israwhidebroken/model.py37
1 files changed, 31 insertions, 6 deletions
diff --git a/israwhidebroken/model.py b/israwhidebroken/model.py
index 0c46bc3..13f3209 100644
--- a/israwhidebroken/model.py
+++ b/israwhidebroken/model.py
@@ -4,10 +4,10 @@ pkg_resources.require("SQLObject>=0.10.1")
from turbogears.database import PackageHub
# import some basic SQLObject classes for declaring the data model
# (see http://www.sqlobject.org/SQLObject.html#declaring-the-class)
-from sqlobject import SQLObject, SQLObjectNotFound, RelatedJoin
+from sqlobject import SQLObject, SQLObjectNotFound, MultipleJoin, RelatedJoin
# import some datatypes for table columns from SQLObject
# (see http://www.sqlobject.org/SQLObject.html#column-types for more)
-from sqlobject import StringCol, UnicodeCol, IntCol, DateTimeCol
+from sqlobject import StringCol, UnicodeCol, IntCol, DateTimeCol, ForeignKey
from turbogears import identity
__connection__ = hub = PackageHub('israwhidebroken')
@@ -15,10 +15,35 @@ __connection__ = hub = PackageHub('israwhidebroken')
# your data model
-
-# class YourDataClass(SQLObject):
-# pass
-
+class Tree(SQLObject):
+ arch = StringCol(length=10, notNone=True)
+ # These could be null if repodata/images are missing
+ tree_time = DateTimeCol()
+ repodata_time = DateTimeCol()
+ # A tree can have many results you might want to look at
+ results = MultipleJoin('TestResult')
+
+class Test(SQLObject):
+ name = StringCol(notNone=True, unique=True)
+ short_desc = StringCol(notNone=True)
+ uri = StringCol(notNone=True)
+ # Tests also have many results but we don't usually care about viewing
+ # every single test result ever for a given test. Hence no join here.
+
+class TestResult(SQLObject):
+ # References to other objects - each test result comes from running one
+ # Test on a given Tree.
+ test = ForeignKey('Test')
+ tree = ForeignKey('Tree')
+ # result is just an int - 0 for fail, >= 1 for pass.
+ # It's not a float 'cuz we don't have any performance tests in RATS.
+ # XXX - How do we want to handle WARN or ERROR?
+ result = IntCol(notNone=True)
+ # bug_id for further information, esp. if the test is a fail.
+ # XXX list of bug IDs?
+ bug_id = IntCol()
+ # timestamp this result was entered
+ timestamp = DateTimeCol(notNone=True)
# the identity model