contact sql
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 29 Jul 2014 20:02:41 +0000 (16:02 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 29 Jul 2014 20:02:41 +0000 (16:02 -0400)
script for setting contact types for old records

Toolkit/Contacts/Database/updateContactTypes.sql [new file with mode: 0644]

diff --git a/Toolkit/Contacts/Database/updateContactTypes.sql b/Toolkit/Contacts/Database/updateContactTypes.sql
new file mode 100644 (file)
index 0000000..38f74ff
--- /dev/null
@@ -0,0 +1,6 @@
+--
+-- Update old contacts with the contact types
+--
+
+UPDATE contacts.contact SET contact_type = ':5:' WHERE arrival IS NOT NULL AND mail_ok = true AND (contact_type = '' OR contact_type IS NULL);
+UPDATE contacts.contact SET contact_type = ':2:' WHERE arrival IS NULL AND mail_ok = true AND (email IS NOT NULL OR email != '') AND (contact_type = '' OR contact_type IS NULL);
\ No newline at end of file