update script for UserAngelTypes and fixes to install.sql

This commit is contained in:
Jan-Philipp Litza 2011-12-26 16:56:54 +01:00
parent d9896abc4d
commit 01e7bdce1d
2 changed files with 19 additions and 2 deletions

View File

@ -1173,10 +1173,10 @@ CREATE TABLE IF NOT EXISTS `Wecken` (
-- Tabellenstruktur für Tabelle `UserAngelTypes` -- Tabellenstruktur für Tabelle `UserAngelTypes`
-- --
CREATE TABLE `engelsystem`.`UserAngelTypes` ( CREATE TABLE IF NOT EXISTS `UserAngelTypes` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`user_id` INT NOT NULL , `user_id` INT NOT NULL ,
`angeltype_id` INT NOT NULL , `angeltype_id` INT NOT NULL ,
`confirm_user_id` INT NULL , `confirm_user_id` INT NULL ,
INDEX ( `user_id` , `angeltype_id` , `confirm_user_id` ) INDEX ( `user_id` , `angeltype_id` , `confirm_user_id` )
) ENGINE = MYISAM ; ) ENGINE = MYISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

View File

@ -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;
}