Fix import scripts.
[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` (
d1a2252a
GB
5 `network_type` tinyint unsigned NOT NULL,
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',
dc6378df 9 `link` varchar(255) NOT NULL COMMENT 'string used to forge an URL linking to the the profile page',
d1a2252a 10 PRIMARY KEY (`network_type`)
950bf4f6 11) ENGINE=InnoDB, CHARSET=utf8, COMMENT='types of networking addresses';
d1a2252a 12
d0293d9b 13
d1a2252a 14CREATE TABLE IF NOT EXISTS `profile_networking` (
6337709a 15 `uid` int NOT NULL COMMENT 'user id',
d1a2252a
GB
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',
aaeb5ec6
FB
20 PRIMARY KEY (`uid`, `nwid`),
21 INDEX uid (uid)
950bf4f6 22) ENGINE=InnoDB, CHARSET=utf8, COMMENT='networking addresses';
d1a2252a 23
1052148d 24-- Insert a first address type for old URLs
d1a2252a
GB
25INSERT INTO `profile_networking_enum` (`network_type`, `name`, `icon`, `filter`)
26 VALUES (0, 'Page web', 'web.gif', 'web');
27
28INSERT INTO `profile_networking` (`uid`, `nwid`, `network_type`, `address`, `pub`)
29 SELECT `user_id`, 0, 0, `profile_web`, `profile_web_pub`
100e66fc 30 FROM #x4dat#.`auth_user_quick`
d1a2252a
GB
31 WHERE `profile_web` <> "";
32
1052148d
GB
33-- Modify watch_profile to update 'field' from web to networking
34ALTER 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
39UPDATE `watch_profile` SET `field` = 'networking' WHERE `field` = 'web';
40
41ALTER 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
aaeb5ec6 46# vim:set syntax=mysql: