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