diff options
Diffstat (limited to 'python/tbc_www/models.py')
-rw-r--r-- | python/tbc_www/models.py | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py new file mode 100644 index 0000000..b51e154 --- /dev/null +++ b/python/tbc_www/models.py @@ -0,0 +1,111 @@ +# Copyright 1998-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from django.db import models + +class Categories(models.Model): + CategoryId = models.IntegerField(primary_key=True, db_column='category_id') + Category = models.CharField(max_length=150, db_column='category') + Active = models.BooleanField(db_column='active') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'categories' + def __str__(self): + return '%s %s %s %s' % (self.CategoryId, self.Category, self.Active, self.TimeStamp) + +class Repos(models.Model): + RepoId = models.IntegerField(primary_key=True, db_column='repo_id') + Repo = models.CharField(max_length=100, db_column='repo') + class Meta: + db_table = 'repos' + def __str__(self): + return '%s %s' % (self.RepoId, self.Repo) + +class Packages(models.Model): + PackageId = models.IntegerField(primary_key=True, db_column='package_id') + CategoryId = models.ForeignKey(Categories, db_column='category_id') + Package = models.CharField(max_length=150, db_column='package') + RepoId = models.ForeignKey(Repos, db_column='repo_id') + Checksum = models.CharField(max_length=100, db_column='checksum') + Active = models.BooleanField(db_column='active') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'packages' + def __str__(self): + return '%s %s %s %s %s %s %s' % (self.PackageId, self.CategoryId, self.Package, self.RepoId, self.Checksum, self.Active, self.TimeStamp) + +class Ebuilds(models.Model): + EbuildId = models.IntegerField(primary_key=True, db_column='ebuild_id') + PackageId = models.ForeignKey(Packages, db_column='package_id') + Version = models.CharField(max_length=150, db_column='version') + Checksum = models.CharField(max_length=100, db_column='checksum') + Active = models.BooleanField(db_column='active') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'ebuilds' + def __str__(self): + return '%s %s %s %s %s %s' % (self.EbuildId, self.PackageId, self.Version, self.Checksum, self.Active, self.TimeStamp) + +class EbuildsMetadata(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') + Revision = models.CharField(max_length=30, db_column='revision') + Descriptions = models.CharField(max_length=200, db_column='descriptions') + class Meta: + db_table = 'ebuilds_metadata' + def __str__(self): + return '%s %s %s %s' % (self.Id, self.EbuildId, self.Revision, self.Descriptions) + +class BuildLogs(models.Model): + BuildLogId = models.IntegerField(primary_key=True, db_column='build_log_id') + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') + Fail = models.BooleanField(db_column='fail') + SummeryText = models.TextField(db_column='summery_text') + LogHash = models.CharField(max_length=100, db_column='log_hash') + BugId = models.IntegerField( db_column='bug_id') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'build_logs' + def __str__(self): + return '%s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp) + +class BuildLogsRepomanQa(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + BuildLogId = models.ForeignKey(BuildLogs, db_column='build_log_id') + SummeryText = models.TextField(db_column='summery_text') + class Meta: + db_table = 'build_logs_repoman' + def __str__(self): + return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText) + +class Setups(models.Model): + SetupId = models.AutoField(primary_key=True, db_column='setup_id') + Setup = models.CharField(max_length=100, db_column='setup') + Profile = models.CharField(max_length=150, db_column='profile') + class Meta: + db_table = 'setups' + def __str__(self): + return '%s %s %s' % (self.SetupId, self.Setup, self.Profile) + +class Configs(models.Model): + ConfigId = models.AutoField(primary_key=True, db_column='config_id') + HostName = models.CharField(max_length=150, db_column='hostname') + SetupId = models.ForeignKey(Setups, db_column='setup_id') + DefaultConfig = models.BooleanField(db_column='default_config') + class Meta: + db_table = 'configs' + def __str__(self): + return '%s %s %s %s' % (self.ConfigId, self.HostName, self.SetupId, self.DefaultConfig) + +class BuildJobs(models.Model): + BuildJobId = models.AutoField(primary_key=True, db_column='build_job_id') + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') + ConfigId = models.ForeignKey(Configs, db_column='config_id') + Status = models.CharField(max_length=21, db_column='status') + BuildNow = models.BooleanField(db_column='build_now') + RemoveBin = models.BooleanField(db_column='removebin') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'build_jobs' + def __str__(self): + return '%s %s %s %s %s %s %s' % (self.BuildJobId, self.EbuildId, self.ConfigId, self.Status, self.BuildNow, self.RemoveBin, self.TimeStamp) |