]> git.ozlabs.org Git - patchwork/blobdiff - lib/sql/migration/011-patch-change-notifications.sql
models: Add PatchChangeNotification and record patch state changes
[patchwork] / lib / sql / migration / 011-patch-change-notifications.sql
diff --git a/lib/sql/migration/011-patch-change-notifications.sql b/lib/sql/migration/011-patch-change-notifications.sql
new file mode 100644 (file)
index 0000000..0a9b9b7
--- /dev/null
@@ -0,0 +1,12 @@
+BEGIN;
+CREATE TABLE "patchwork_patchchangenotification" (
+    "patch_id" integer NOT NULL PRIMARY KEY REFERENCES "patchwork_patch" ("id") DEFERRABLE INITIALLY DEFERRED,
+    "last_modified" timestamp with time zone NOT NULL,
+    "orig_state_id" integer NOT NULL REFERENCES "patchwork_state" ("id") DEFERRABLE INITIALLY DEFERRED
+)
+;
+ALTER TABLE "patchwork_project" ADD COLUMN
+    "send_notifications" boolean NOT NULL DEFAULT False;
+ALTER TABLE "patchwork_project" ALTER COLUMN
+    "send_notifications" DROP DEFAULT;
+COMMIT;