stgleb | 75c7041 | 2015-02-17 02:52:00 +0200 | [diff] [blame] | 1 | from sqlalchemy import ForeignKey |
| 2 | from web_app.app import db |
| 3 | |
| 4 | |
| 5 | class Build(db.Model): |
| 6 | id = db.Column(db.Integer, primary_key=True) |
| 7 | build_id = db.Column(db.String(64)) |
| 8 | name = db.Column(db.String(64)) |
| 9 | md5 = db.Column(db.String(64)) |
| 10 | type = db.Column(db.Integer) |
| 11 | |
| 12 | def __repr__(self): |
| 13 | return self.build_id + " " + self.name + " " + self.type |
| 14 | |
| 15 | |
| 16 | class Param(db.Model): |
| 17 | id = db.Column(db.Integer, primary_key=True) |
| 18 | name = db.Column(db.String(64)) |
| 19 | type = db.Column(db.String(64)) |
| 20 | descr = db.Column(db.String(4096)) |
| 21 | |
| 22 | |
| 23 | class ParamCombination(db.Model): |
| 24 | id = db.Column(db.Integer, primary_key=True) |
| 25 | param_1 = db.Column(db.Text()) |
| 26 | param_2 = db.Column(db.Text()) |
| 27 | param_3 = db.Column(db.Text()) |
| 28 | |
| 29 | def __repr__(self): |
| 30 | return self.param_1 + " " + self.param_2 + " " + self.param_3 |
| 31 | |
| 32 | |
| 33 | class Lab(db.Model): |
| 34 | id = db.Column(db.Integer, primary_key=True) |
gstepanov | 15681d6 | 2015-02-23 17:17:50 +0200 | [diff] [blame^] | 35 | name = db.Column(db.String(64), unique=True) |
| 36 | url = db.Column(db.String(256)) |
stgleb | 75c7041 | 2015-02-17 02:52:00 +0200 | [diff] [blame] | 37 | type = db.Column(db.String(4096)) |
gstepanov | 15681d6 | 2015-02-23 17:17:50 +0200 | [diff] [blame^] | 38 | fuel_version = db.Column(db.String(64)) |
| 39 | ceph_version = db.Column(db.String(64)) |
| 40 | lab_general_info = db.Column(db.Text) |
| 41 | lab_meta = db.Column(db.Text) |
stgleb | 75c7041 | 2015-02-17 02:52:00 +0200 | [diff] [blame] | 42 | |
| 43 | |
| 44 | class Result(db.Model): |
| 45 | id = db.Column(db.Integer, primary_key=True) |
| 46 | build_id = db.Column(db.Integer, ForeignKey('build.id')) |
gstepanov | 15681d6 | 2015-02-23 17:17:50 +0200 | [diff] [blame^] | 47 | lab_id = db.Column(db.Integer, ForeignKey('lab.id')) |
stgleb | 75c7041 | 2015-02-17 02:52:00 +0200 | [diff] [blame] | 48 | date = db.Column(db.DateTime) |
| 49 | param_combination_id = db.Column(db.Integer, ForeignKey('param_combination.id')) |
| 50 | bandwith = db.Column(db.Float) |
| 51 | meta = db.Column(db.String(4096)) |
| 52 | |
| 53 | def __repr__(self): |
| 54 | return str(self.bandwith) + " " + str(self.date) |