]> err.no Git - scalable-opengroupware.org/blob - OGoContentStore/sql/sogo-folderinfo.sh
initial sync
[scalable-opengroupware.org] / OGoContentStore / sql / sogo-folderinfo.sh
1 #!/bin/bash
2 #
3 # Usage: generate-folderinfo-sql-for-users user1 [user2] [user3] [...]
4 #
5
6 DB_USER="sogo"
7 DB_PASS="sogo"
8 DB_HOST="192.168.0.4"
9 DB_PORT="5432"
10 DB_NAME="sogo"
11 TIMEZONE="Canada/Eastern"
12
13
14 while [ "$1" != "" ]; do
15 USER_ID=$1
16 USER_TABLE=`echo $USER_ID | tr -s [:punct:] _`
17 cat << EOF
18 --
19 -- (C) 2004 SKYRIX Software AG
20 --
21 -- TODO:
22 --   add a unique constraints on path
23
24 DELETE FROM SOGo_folder_info WHERE c_path2 = '${USER_ID}';
25
26 INSERT INTO SOGo_folder_info 
27   ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
28     c_location, c_quick_location, c_folder_type ) 
29 VALUES 
30   ( '/Users/${USER_ID}', 
31     'Users',
32     '${USER_ID}',
33     NULL,
34     NULL,
35     '${USER_ID}', 
36     'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_user_folder', 
37     'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_user_folder_quick', 
38     'Container' );
39
40 INSERT INTO SOGo_folder_info 
41   ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
42     c_location, c_quick_location, c_folder_type ) 
43 VALUES 
44   ( '/Users/${USER_ID}/Calendar', 
45     'Users',
46     '${USER_ID}',
47     'Calendar',
48      NULL,
49     'Calendar', 
50     'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal', 
51     'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_quick', 
52     'Appointment' );
53
54 INSERT INTO SOGo_folder_info 
55   ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
56     c_location, c_quick_location, c_folder_type ) 
57 VALUES 
58   ( '/Users/${USER_ID}/Contacts/personal', 
59     'Users',
60     '${USER_ID}',
61     'Contacts',
62     'personal',
63     'Contacts', 
64     'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts', 
65     'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_quick', 
66     'Contact' );
67
68 EOF
69 shift
70 done