summaryrefslogtreecommitdiffstats
path: root/lib/sql/migration/015-add-patch-tags.sql
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sql/migration/015-add-patch-tags.sql')
-rw-r--r--lib/sql/migration/015-add-patch-tags.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/sql/migration/015-add-patch-tags.sql b/lib/sql/migration/015-add-patch-tags.sql
new file mode 100644
index 0000000..bdf7330
--- /dev/null
+++ b/lib/sql/migration/015-add-patch-tags.sql
@@ -0,0 +1,19 @@
+BEGIN;
+ALTER TABLE patchwork_project ADD COLUMN use_tags boolean default true;
+
+CREATE TABLE "patchwork_tag" (
+ "id" serial NOT NULL PRIMARY KEY,
+ "name" varchar(20) NOT NULL,
+ "pattern" varchar(50) NOT NULL,
+ "abbrev" varchar(2) NOT NULL UNIQUE
+);
+
+CREATE TABLE "patchwork_patchtag" (
+ "id" serial NOT NULL PRIMARY KEY,
+ "patch_id" integer NOT NULL,
+ "tag_id" integer NOT NULL REFERENCES "patchwork_tag" ("id"),
+ "count" integer NOT NULL,
+ UNIQUE ("patch_id", "tag_id")
+);
+
+COMMIT;