[PATCH] add apps directory; add model classes; add db_tools directory;

From: "Hongyuan Ma" <cs_maleicacid(at)163(dot)com>
To: "Dave Page" <dpage(at)pgadmin(dot)org>, "mark(at)2ndQuadrant(dot)com" <mark(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] add apps directory; add model classes; add db_tools directory;
Date: 2018-03-17 04:35:38
Message-ID: 453dea42.1fa0.162323ddf44.Coremail.cs_maleicacid@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

---
.gitignore | 2 ++
web/apps/__init__.py | 0
web/apps/test_item/__init__.py | 0
web/apps/test_item/admin.py | 3 ++
web/apps/test_item/models.py | 35 +++++++++++++++++++
web/apps/test_item/tests.py | 3 ++
web/apps/test_item/views.py | 3 ++
web/apps/user_operation/__init__.py | 0
web/apps/user_operation/admin.py | 3 ++
web/apps/user_operation/models.py | 58 ++++++++++++++++++++++++++++++++
web/apps/user_operation/tests.py | 3 ++
web/apps/user_operation/views.py | 3 ++
web/db.sqlite3 | Bin 0 -> 50176 bytes
web/db_tools/data/__init__.py | 0
web/db_tools/data/test_branch_date.py | 11 ++++++
web/db_tools/import_test_branch_data.py | 22 ++++++++++++
web/pgperffarm/settings.py | 8 ++++-
web/pgperffarm/urls.py | 2 +-
18 files changed, 154 insertions(+), 2 deletions(-)
create mode 100644 web/apps/__init__.py
create mode 100644 web/apps/test_item/__init__.py
create mode 100644 web/apps/test_item/admin.py
create mode 100644 web/apps/test_item/models.py
create mode 100644 web/apps/test_item/tests.py
create mode 100644 web/apps/test_item/views.py
create mode 100644 web/apps/user_operation/__init__.py
create mode 100644 web/apps/user_operation/admin.py
create mode 100644 web/apps/user_operation/models.py
create mode 100644 web/apps/user_operation/tests.py
create mode 100644 web/apps/user_operation/views.py
create mode 100644 web/db.sqlite3
create mode 100644 web/db_tools/data/__init__.py
create mode 100644 web/db_tools/data/test_branch_date.py
create mode 100644 web/db_tools/import_test_branch_data.py

diff --git a/.gitignore b/.gitignore
index 239c691..f6dc301 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ migrations
*.psp
.DS_Store
tags
+
+.idea
\ No newline at end of file
diff --git a/web/apps/__init__.py b/web/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/web/apps/test_item/__init__.py b/web/apps/test_item/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/web/apps/test_item/admin.py b/web/apps/test_item/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/web/apps/test_item/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/web/apps/test_item/models.py b/web/apps/test_item/models.py
new file mode 100644
index 0000000..428dc0b
--- /dev/null
+++ b/web/apps/test_item/models.py
@@ -0,0 +1,35 @@
+from datetime import datetime
+
+from django.db import models
+
+# Create your models here.
+class TestBranch(models.Model):
+ """
+ test brand
+ """
+ branch_name = models.CharField(max_length=128, verbose_name="branch name", help_text="branch name")
+ add_time = models.DateTimeField(default=datetime.now, verbose_name="branch added time", help_text="branch added time")
+
+ class Meta:
+ verbose_name = "test branch"
+ verbose_name_plural = "test branch"
+
+ def __str__(self):
+ return self.branch_name
+
+class TestItem(models.Model):
+ """
+ test_item
+ """
+ test_name = models.CharField(max_length=128, verbose_name="test name", help_text="test name")
+ test_desc = models.TextField(verbose_name="test desc", help_text="test desc")
+ test_metric = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="test metric", help_text="score>metric means improving;score<=metric means declining;")
+ test_branch = models.ForeignKey(TestBranch ,verbose_name="test branch", help_text="test branch")
+ add_time = models.DateTimeField(default=datetime.now, verbose_name="test added time")
+
+ class Meta:
+ verbose_name = "test_item"
+ verbose_name_plural = "test_item"
+
+ def __str__(self):
+ return self.test_name
diff --git a/web/apps/test_item/tests.py b/web/apps/test_item/tests.py
new file mode 100644
index 0000000..a6019d6
--- /dev/null
+++ b/web/apps/test_item/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your test_item here.
diff --git a/web/apps/test_item/views.py b/web/apps/test_item/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/web/apps/test_item/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/web/apps/user_operation/__init__.py b/web/apps/user_operation/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/web/apps/user_operation/admin.py b/web/apps/user_operation/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/web/apps/user_operation/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/web/apps/user_operation/models.py b/web/apps/user_operation/models.py
new file mode 100644
index 0000000..ca426f1
--- /dev/null
+++ b/web/apps/user_operation/models.py
@@ -0,0 +1,58 @@
+from datetime import datetime
+
+from django.db import models
+from django.contrib.auth.models import User
+from test_item.models import TestItem
+# Create your models here.
+
+class Alias(models.Model):
+ """
+ alias
+ """
+ name = models.CharField(max_length=64, verbose_name="plants name")
+
+ class Meta:
+ verbose_name = "alias"
+ verbose_name_plural = "alias"
+
+ def __str__(self):
+ return self.name
+
+class UserMachine(models.Model):
+ """
+ user machine
+ """
+ machine_sn = models.CharField(max_length=16, verbose_name="machine sn")
+ machine_secret = models.CharField(max_length=32, verbose_name="machine secret")
+ machine_owner = models.ForeignKey(User)
+ alias = models.ForeignKey(Alias)
+ os_name = models.CharField(max_length=32, verbose_name="operation system name")
+ os_version = models.CharField(max_length=32, verbose_name="operation system version")
+ comp_name = models.CharField(max_length=32, verbose_name="compiler name")
+ comp_version = models.CharField(max_length=32, verbose_name="compiler version")
+ is_active = models.BooleanField(default=False, verbose_name="machine is active", help_text="Only when the value is True can the machine submit test results.")
+ add_time = models.DateTimeField(default=datetime.now, verbose_name="machine added time")
+
+ class Meta:
+ verbose_name = "user machine"
+ verbose_name_plural = "user machine"
+
+ def __str__(self):
+ return self.machine_sn
+
+class TestResult(models.Model):
+ """
+ test result
+ """
+ test = models.ForeignKey(TestItem)
+ machine = models.ForeignKey(UserMachine)
+ result_score = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="result score", help_text="score>metric means improving;score<=metric means declining;")
+ pg_config = models.TextField(verbose_name="postgresql config", help_text="postgresql config")
+ os_config = models.TextField(verbose_name="os config", help_text="os config")
+ result_desc = models.TextField(verbose_name="test result", help_text="test result")
+
+ test_time = models.DateTimeField(verbose_name="test time")
+
+ class Meta:
+ verbose_name = "test result"
+ verbose_name_plural = "test result"
\ No newline at end of file
diff --git a/web/apps/user_operation/tests.py b/web/apps/user_operation/tests.py
new file mode 100644
index 0000000..a6019d6
--- /dev/null
+++ b/web/apps/user_operation/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your test_item here.
diff --git a/web/apps/user_operation/views.py b/web/apps/user_operation/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/web/apps/user_operation/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/web/db.sqlite3 b/web/db.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..11140436bfc1069fe740f30ca1ec8c762fcc6c09
GIT binary patch
literal 50176
zcmeHQX>26Nb*}2_nc;AG>_KjGmsgV%MYg#lXE;2yS+B=yT4r{aEA3%tqXg~du*n^H
zI77`0SCZib8FIZgVh4#OATaX72(at)w4VVgyMHB*+g72m}N+Vjve1zzGsSQ2^OL90zfL
zT*{BUs;=&??m0-2T0rE~NL%cxdiCnnS6BCYb=-OWMz(D08-?PQRn}8TMHr)x={iDa
z9R4NYpZi;a2i5h!Uo1S=dmKlT(at)1BZ4Yzz55rI{q}k$)%uNq$6rK;9w$M81FJ3f{X?
zw$^g?Zd8qFsTAHzG4J||R(`W!W(xVToiCf^SGVmNL6K{>m(zEb^}Feh-&od%Yfud9
z<HOnYVLc0cHtnLmdh4#fdhf;!{khvKH`BN8>(`g>>*;%UZ>_8Xuba!OcQ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8DC
zp<OJ&5zRh}5J{%6wcVHrqu7rPtoo&AK|cf~_FAD3&|o)E-U;oZ(at)Nym$^ED685LKJr
z`fIN-$oKyzIO<8(5`hmn0(AaY(Pcz#;IE>0;NjrE%2V?(?fI+jy_})hf?7ei9c{)=
z%xBiE*}4={d^+K$n$)E;T~3YxtS%iL-5e_ny`6Jx&JpuEGs)FWWLit9h1sQ<g}M~(
zOUJ%qx||LmraO_*v)K2p%(Azl$MHkH6-_ssmi-#xqyPJxl|O8(at)R$=zrciszCDfNcl
zih!HjVya;gr%;DVH0gSCX(c)19Q*%5t(GQaYA$8gmew{hsrqucX7k!(at)troAEjZGk=
zV!Ex(dtDIs|6DqF*O!zM0g1p#KtSsMPC_lpGDrjthXC#WJ+PgR{3H1m`Lf*q=Pam_
z`~T$rKT!J#+wc4>I45TRAKOhx`+rpV5h8y_-XJB|_16m?`I88oKm;ZS=+51x>b;gi
zKc}Dfx})lt?03ld9y(urLdl&#wjZ67kM+(at)=zNyg8OiBwXe35Xv7YLJ=YwXq(<e(q!
hI{#dszUU<2f(YOAf+S)B;{qg(at)m<#XjbY&4q{~u+n0jB(at)}

literal 0
HcmV?d00001

diff --git a/web/db_tools/data/__init__.py b/web/db_tools/data/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/web/db_tools/data/test_branch_date.py b/web/db_tools/data/test_branch_date.py
new file mode 100644
index 0000000..04d0251
--- /dev/null
+++ b/web/db_tools/data/test_branch_date.py
@@ -0,0 +1,11 @@
+row_data = [
+ {
+ 'name': 'HEAD',
+ },
+ {
+ 'name': 'REL_10_STABLE',
+ },
+ {
+ 'name': 'REL9_6_STABLE',
+ }
+]
\ No newline at end of file
diff --git a/web/db_tools/import_test_branch_data.py b/web/db_tools/import_test_branch_data.py
new file mode 100644
index 0000000..e85b538
--- /dev/null
+++ b/web/db_tools/import_test_branch_data.py
@@ -0,0 +1,22 @@
+import sys
+import os
+
+
+# Use django's model independently
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.extend([BASE_DIR,])
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pgperffarm.settings")
+
+# Initialize django
+import django
+django.setup()
+
+from test_item.models import TestBranch
+from data.test_branch_date import row_data
+
+for test_branch in row_data:
+ branch = TestBranch()
+ branch.name = test_branch["name"]
+
+ branch.save()
\ No newline at end of file
diff --git a/web/pgperffarm/settings.py b/web/pgperffarm/settings.py
index 38fdf8a..f6c9a14 100644
--- a/web/pgperffarm/settings.py
+++ b/web/pgperffarm/settings.py
@@ -1,5 +1,6 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
+import sys

# Load local settings overrides
from settings_local import *
@@ -16,8 +17,10 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

-BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.insert(0, BASE_DIR)
+sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
@@ -41,6 +44,9 @@ INSTALLED_APPS = (
'django.contrib.messages',
'django.contrib.staticfiles',
'django_gravatar',
+ 'test_item',
+ 'user_operation',
+ # 'rest_framework', need Django 1.10+
)

MIDDLEWARE_CLASSES = (
diff --git a/web/pgperffarm/urls.py b/web/pgperffarm/urls.py
index 3b439eb..87869de 100644
--- a/web/pgperffarm/urls.py
+++ b/web/pgperffarm/urls.py
@@ -35,5 +35,5 @@ urlpatterns = [
'document_root': '/static',
}),
url(r'^favicon\.ico$', RedirectView.as_view(url='/static/favicon.ico',
- permanent=True))
+ permanent=True)),
]
--
2.12.0.windows.1

Browse pgsql-hackers by date

  From Date Subject
Next Message Arthur Zakirov 2018-03-17 04:43:39 Re: [PROPOSAL] Shared Ispell dictionaries
Previous Message Huong Dangminh 2018-03-17 01:47:38 RE: User defined data types in Logical Replication