Moving to GitHub.
[platal.git] / upgrade / newdirectory-0.0.1 / 02_networking.sql
CommitLineData
d0293d9b
FB
1DROP TABLE IF EXISTS profile_networking_enum;
2DROP TABLE IF EXISTS profile_networking;
3
4CREATE TABLE `profile_networking_enum` (
34de4b20 5 `nwid` tinyint unsigned NOT NULL,
d1a2252a
GB
6 `name` varchar(30) NOT NULL,
7 `icon` varchar(50) NOT NULL COMMENT 'icon filename',
92446a53 8 `filter` enum('email','web','number','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses',
34de4b20 9 `network_type` enum('web','im','social','other') NOT NULL DEFAULT 'other',
dc6378df 10 `link` varchar(255) NOT NULL COMMENT 'string used to forge an URL linking to the the profile page',
34de4b20 11 PRIMARY KEY (`nwid`)
950bf4f6 12) ENGINE=InnoDB, CHARSET=utf8, COMMENT='types of networking addresses';
d1a2252a 13
d0293d9b 14
ce0b2c6f
FB
15CREATE TABLE `profile_networking` (
16 `pid` int NOT NULL COMMENT 'profile id',
34de4b20
PC
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',
d1a2252a
GB
19 `address` varchar(255) NOT NULL,
20 `pub` enum('private','public') NOT NULL DEFAULT 'private',
34de4b20 21 PRIMARY KEY (`pid`, `id`),
ce0b2c6f 22 INDEX uid (pid)
950bf4f6 23) ENGINE=InnoDB, CHARSET=utf8, COMMENT='networking addresses';
d1a2252a 24
1052148d 25-- Insert a first address type for old URLs
34de4b20
PC
26INSERT INTO `profile_networking_enum` (`nwid`, `name`, `icon`, `filter`, `network_type`, `link`)
27 VALUES (0, 'Page web', 'web.gif', 'web', 'web', '%s');
d1a2252a 28
34de4b20 29INSERT INTO `profile_networking` (`pid`, `id`, `nwid`, `address`, `pub`)
d1a2252a 30 SELECT `user_id`, 0, 0, `profile_web`, `profile_web_pub`
100e66fc 31 FROM #x4dat#.`auth_user_quick`
d1a2252a
GB
32 WHERE `profile_web` <> "";
33
1052148d 34-- Modify watch_profile to update 'field' from web to networking
86c104d1
SJ
35ALTER 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');
1052148d
GB
39
40UPDATE `watch_profile` SET `field` = 'networking' WHERE `field` = 'web';
41
86c104d1
SJ
42ALTER 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');
1052148d 46
aaeb5ec6 47# vim:set syntax=mysql: