From 56e2243f3be7e859666ce0e4e1a8b8b94444f8d4 Mon Sep 17 00:00:00 2001
From: Jeremy Kerr <jk@ozlabs.org>
Date: Thu, 12 Aug 2010 12:15:48 +0800
Subject: Use generic email confirmation object

Rather than having a UserPerson-specific confirmation, add an
EmailConfirmation object to allow multiple types of confirmations (eg,
opt-out requests in future).

To do this, we use a view (patchwork.views.confirm) that will call the
type-specific view with the confirmation object.

Also, add tests to check that the User/Person linkage system works.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 lib/sql/migration/008-confirmations.sql | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 lib/sql/migration/008-confirmations.sql

(limited to 'lib/sql/migration/008-confirmations.sql')

diff --git a/lib/sql/migration/008-confirmations.sql b/lib/sql/migration/008-confirmations.sql
new file mode 100644
index 0000000..89437a2
--- /dev/null
+++ b/lib/sql/migration/008-confirmations.sql
@@ -0,0 +1,11 @@
+BEGIN;
+ALTER TABLE "patchwork_userpersonconfirmation"
+        RENAME TO "patchwork_emailconfirmation";
+ALTER SEQUENCE "patchwork_userpersonconfirmation_id_seq"
+        RENAME TO "patchwork_emailconfirmation_id_seq";
+ALTER TABLE "patchwork_emailconfirmation"
+        ALTER COLUMN "user_id" DROP NOT NULL,
+        ADD COLUMN "type" varchar(20) NOT NULL DEFAULT 'userperson';
+ALTER TABLE "patchwork_emailconfirmation"
+        ALTER COLUMN "type" DROP DEFAULT;
+COMMIT;
-- 
cgit v1.2.3

