summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/models.py11
-rw-r--r--migrate_signoff.sql14
2 files changed, 25 insertions, 0 deletions
diff --git a/main/models.py b/main/models.py
index f7d4c2c3..7cd00bff 100644
--- a/main/models.py
+++ b/main/models.py
@@ -266,6 +266,17 @@ class Package(models.Model):
deps.append({'dep': dep, 'pkg': pkg})
return deps
+class Signoff(models.Model):
+ pkg = models.ForeignKey(Package)
+ pkgver = models.CharField(maxlength=255)
+ pkgrel = models.CharField(maxlength=255)
+ signed_off = models.ManyToManyField(User)
+
+ def is_approved(self):
+ if signed_off.all().count() > 2:
+ return True
+ return False
+
class PackageFile(models.Model):
id = models.AutoField(primary_key=True)
pkg = models.ForeignKey('Package')
diff --git a/migrate_signoff.sql b/migrate_signoff.sql
new file mode 100644
index 00000000..ed2ceef5
--- /dev/null
+++ b/migrate_signoff.sql
@@ -0,0 +1,14 @@
+CREATE TABLE `main_signoff` (
+ `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ `pkg_id` integer NOT NULL,
+ `pkgver` varchar(255) NOT NULL,
+ `pkgrel` varchar(255) NOT NULL
+);
+CREATE TABLE `main_signoff_signed_off` (
+ `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ `signoff_id` integer NOT NULL REFERENCES `main_signoff` (`id`),
+ `user_id` integer NOT NULL REFERENCES `auth_user` (`id`),
+ UNIQUE (`signoff_id`, `user_id`)
+);
+CREATE INDEX main_signoff_pkg_id ON `main_signoff` (`pkg_id`);
+