diff options
author | chenjiankun <chenjiankun1@huawei.com> | 2017-07-11 09:44:48 +0000 |
---|---|---|
committer | Jack Chan <chenjiankun1@huawei.com> | 2017-07-12 01:37:21 +0000 |
commit | e6b3c9dbeb1210af5f0f84b4a582f65d2d31058b (patch) | |
tree | 1be7eea46b8111110d0711a45b93b002fae8a95f /api/database/v2/models.py | |
parent | 7ee54db221fbb4173de011585a425f0750dd6ccf (diff) |
Yardstick api database v2 model
JIRA: YARDSTICK-713
We have api v2 for gui, and they are all based on the database model.
Change-Id: I51b127588b0b84316acff8acf4a7886339646060
Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'api/database/v2/models.py')
-rw-r--r-- | api/database/v2/models.py | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/api/database/v2/models.py b/api/database/v2/models.py new file mode 100644 index 000000000..64d49cc9d --- /dev/null +++ b/api/database/v2/models.py @@ -0,0 +1,100 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +from __future__ import absolute_import +from sqlalchemy import Column +from sqlalchemy import Integer +from sqlalchemy import String +from sqlalchemy import Text +from sqlalchemy import DateTime +from sqlalchemy import Boolean + +from api.database import Base + + +class V2Environment(Base): + __tablename__ = 'v2_environment' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + name = Column(String(30)) + description = Column(Text) + openrc_id = Column(String(10)) + image_id = Column(String(30)) + container_id = Column(Text) + pod_id = Column(String(10)) + time = Column(DateTime) + + +class V2Openrc(Base): + __tablename__ = 'V2_openrc' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + name = Column(String(30)) + description = Column(Text) + environment_id = Column(String(30)) + content = Column(Text) + time = Column(DateTime) + + +class V2Image(Base): + __tablename__ = 'v2_image' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + name = Column(String(30)) + description = Column(Text) + environment_id = Column(String(30)) + size = Column(String(30)) + status = Column(String(30)) + time = Column(DateTime) + + +class V2Container(Base): + __tablename__ = 'v2_container' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + name = Column(String(30)) + environment_id = Column(String(30)) + status = Column(Integer) + port = Column(Integer) + time = Column(String(30)) + + +class V2Pod(Base): + __tablename__ = 'v2_pod' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + environment_id = Column(String(30)) + content = Column(Text) + time = Column(String(30)) + + +class V2Project(Base): + __tablename__ = 'v2_project' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + name = Column(String(30)) + description = Column(Text) + time = Column(DateTime) + tasks = Column(Text) + + +class V2Task(Base): + __tablename__ = 'v2_task' + id = Column(Integer, primary_key=True) + uuid = Column(String(30)) + name = Column(String(30)) + description = Column(Text) + project_id = Column(String(30)) + environment_id = Column(String(30)) + time = Column(DateTime) + case_name = Column(String(30)) + suite = Column(Boolean) + content = Column(Text) + result = Column(Text) + error = Column(Text) + status = Column(Integer) |