Corrects birthdate when birthdate is null and birthdate_ref is correct.
authorAnne Limoges <anne.limoges_git@polytechnique.org>
Sat, 8 Mar 2014 17:38:18 +0000 (18:38 +0100)
committerAnne Limoges <anne.limoges_git@polytechnique.org>
Sat, 8 Mar 2014 17:39:28 +0000 (18:39 +0100)
upgrade/1.1.12/08_correct_birthdate.sql [new file with mode: 0644]

diff --git a/upgrade/1.1.12/08_correct_birthdate.sql b/upgrade/1.1.12/08_correct_birthdate.sql
new file mode 100644 (file)
index 0000000..39d1362
--- /dev/null
@@ -0,0 +1,5 @@
+UPDATE profiles as p
+LEFT JOIN account_profiles AS ap ON p.pid = ap.pid
+LEFT JOIN accounts AS a ON a.uid = ap.uid
+SET p.birthdate = p.birthdate_ref
+WHERE p.birthdate_ref AND NOT p.birthdate AND a.state = 'active';