From 798a73b8bfb41f742e78e481ab9c961556e117b3 Mon Sep 17 00:00:00 2001
From: Jeremy Kerr <jk@ozlabs.org>
Date: Tue, 29 Mar 2011 11:58:39 +0800
Subject: models: Add PatchChangeNotification and record patch state changes

Add a PatchChangeNotification model to keep track of changes to a
patch's state. Hook this up to Patch's pre_save signal.

Requires a DB schema upgrade.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 lib/sql/migration/011-patch-change-notifications.sql | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 lib/sql/migration/011-patch-change-notifications.sql

(limited to '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
index 0000000..0a9b9b7
--- /dev/null
+++ b/lib/sql/migration/011-patch-change-notifications.sql
@@ -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;
-- 
cgit v1.2.3

