summaryrefslogtreecommitdiff
path: root/db/update.d
diff options
context:
space:
mode:
authorJan-Philipp Litza <janphilipp@litza.de>2011-12-26 16:56:54 +0100
committerJan-Philipp Litza <janphilipp@litza.de>2011-12-26 16:56:54 +0100
commit01e7bdce1d0a232610b531661f418b0606c0fa84 (patch)
tree48574ea95b2d05148f6553269d6dcd791974e620 /db/update.d
parentd9896abc4d09f4469baa865f2caca457cd227f56 (diff)
update script for UserAngelTypes and fixes to install.sql
Diffstat (limited to 'db/update.d')
-rw-r--r--db/update.d/15_UserAngelTypes.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/update.d/15_UserAngelTypes.php b/db/update.d/15_UserAngelTypes.php
new file mode 100644
index 00000000..81a13f4e
--- /dev/null
+++ b/db/update.d/15_UserAngelTypes.php
@@ -0,0 +1,17 @@
+<?php
+if(sql_num_query("SHOW TABLES LIKE 'UserAngelTypes'") === 0) {
+ sql_query("CREATE TABLE `UserAngelTypes` (
+ `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `user_id` INT NOT NULL ,
+ `angeltype_id` INT NOT NULL ,
+ `confirm_user_id` INT NULL ,
+ INDEX ( `user_id` , `angeltype_id` , `confirm_user_id` )
+ )");
+ sql_query("INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`)
+ SELECT `User`.`UID`, `AngelTypes`.`id`
+ FROM `User`
+ INNER JOIN `AngelTypes`
+ ON TRIM(TRAILING 'Angel' FROM `User`.`Art`) = `AngelTypes`.`name`");
+
+ $applied = true;
+}