| 1 | DROP TABLE IF EXISTS profile_networking_enum; |
| 2 | DROP TABLE IF EXISTS profile_networking; |
| 3 | |
| 4 | CREATE TABLE `profile_networking_enum` ( |
| 5 | `network_type` tinyint unsigned NOT NULL, |
| 6 | `name` varchar(30) NOT NULL, |
| 7 | `icon` varchar(50) NOT NULL COMMENT 'icon filename', |
| 8 | `filter` enum('email','web','number','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses', |
| 9 | `link` varchar(255) NOT NULL COMMENT 'string used to forge an URL linking to the the profile page', |
| 10 | PRIMARY KEY (`network_type`) |
| 11 | ) ENGINE=InnoDB, CHARSET=utf8, COMMENT='types of networking addresses'; |
| 12 | |
| 13 | |
| 14 | CREATE TABLE IF NOT EXISTS `profile_networking` ( |
| 15 | `uid` int NOT NULL COMMENT 'user id', |
| 16 | `nwid` tinyint unsigned NOT NULL COMMENT 'number of the address for the user', |
| 17 | `network_type` tinyint unsigned NOT NULL, |
| 18 | `address` varchar(255) NOT NULL, |
| 19 | `pub` enum('private','public') NOT NULL DEFAULT 'private', |
| 20 | PRIMARY KEY (`uid`, `nwid`), |
| 21 | INDEX uid (uid) |
| 22 | ) ENGINE=InnoDB, CHARSET=utf8, COMMENT='networking addresses'; |
| 23 | |
| 24 | -- Insert a first address type for old URLs |
| 25 | INSERT INTO `profile_networking_enum` (`network_type`, `name`, `icon`, `filter`) |
| 26 | VALUES (0, 'Page web', 'web.gif', 'web'); |
| 27 | |
| 28 | INSERT INTO `profile_networking` (`uid`, `nwid`, `network_type`, `address`, `pub`) |
| 29 | SELECT `user_id`, 0, 0, `profile_web`, `profile_web_pub` |
| 30 | FROM #x4dat#.`auth_user_quick` |
| 31 | WHERE `profile_web` <> ""; |
| 32 | |
| 33 | -- Modify watch_profile to update 'field' from web to networking |
| 34 | ALTER TABLE `watch_profile` |
| 35 | MODIFY `field` enum('nom', 'freetext', 'mobile', 'nationalite', 'nick', |
| 36 | 'web', 'networking', 'appli1', 'appli2', 'addresses', |
| 37 | 'section', 'binets', 'medals', 'cv', 'jobs', 'photo'); |
| 38 | |
| 39 | UPDATE `watch_profile` SET `field` = 'networking' WHERE `field` = 'web'; |
| 40 | |
| 41 | ALTER TABLE `watch_profile` |
| 42 | MODIFY `field` enum('nom', 'freetext', 'mobile', 'nationalite', 'nick', |
| 43 | 'networking', 'appli1', 'appli2', 'addresses', |
| 44 | 'section', 'binets', 'medals', 'cv', 'jobs', 'photo'); |
| 45 | |
| 46 | # vim:set syntax=mysql: |