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