]> err.no Git - scalable-opengroupware.org/blob - OGoContentStore/sql/generate-folderinfo-sql-for-users-sqlite.sh
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1018 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / OGoContentStore / sql / generate-folderinfo-sql-for-users-sqlite.sh
1 #!/bin/bash
2 #
3 # Usage: generate-folderinfo-sql-for-users user1 [user2] [user3] [...]
4 #
5
6 DB="/tmp/sogo-registry.sqlite"
7
8 while [ "$1" != "" ]; do
9 USER_ID=$1
10 USER_TABLE=`echo $USER_ID | tr -s [:punct:] _`
11 cat << EOF
12 DELETE FROM SOGo_folder_info WHERE c_path2 = '${USER_ID}';
13
14 INSERT INTO SOGo_folder_info 
15   ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
16     c_location, c_quick_location, c_folder_type ) 
17 VALUES 
18   ( '/Users/${USER_ID}', 
19     'Users',
20     '${USER_ID}',
21     NULL,
22     NULL,
23     '${USER_ID}', 
24     'sqlite://localhost${DB}/SOGo_user_folder_blob', 
25     'sqlite://localhost${DB}/SOGo_user_folder_quick', 
26     'Container' );
27
28 INSERT INTO SOGo_folder_info 
29   ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
30     c_location, c_quick_location, c_folder_type ) 
31 VALUES 
32   ( '/Users/${USER_ID}/Calendar', 
33     'Users',
34     '${USER_ID}',
35     'Calendar',
36      NULL,
37     'Calendar', 
38     'sqlite://localhost${DB}/SOGo_${USER_TABLE}_privcal_blob', 
39     'sqlite://localhost${DB}/SOGo_${USER_TABLE}_privcal_quick', 
40     'Appointment' );
41
42 INSERT INTO SOGo_folder_info 
43   ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
44     c_location, c_quick_location, c_folder_type ) 
45 VALUES 
46   ( '/Users/${USER_ID}/Contacts', 
47     'Users',
48     '${USER_ID}',
49     'Contacts',
50      NULL,
51     'Contacts', 
52     'sqlite://localhost${DB}/SOGo_${USER_TABLE}_contacts_blob', 
53     'sqlite://localhost${DB}/SOGo_${USER_TABLE}_contacts_quick', 
54     'Contact' );
55
56 DROP TABLE SOGo_${USER_TABLE}_privcal_quick;
57 DROP TABLE SOGo_${USER_TABLE}_privcal_blob;
58
59 CREATE TABLE SOGo_${USER_TABLE}_privcal_quick (
60   c_name       VARCHAR(256)    NOT NULL PRIMARY KEY, /* the filename */
61   uid          VARCHAR(256)    NOT NULL,
62   startdate    INT             NOT NULL,
63   enddate      INT             NOT NULL,
64   cycleenddate INT             NULL,     /* enddate for cyclic events */
65   title        VARCHAR(1000)   NOT NULL,
66   cycleinfo    VARCHAR(1000)   NULL,     /* property list with cycle infos */
67   participants VARCHAR(100000) NOT NULL, /* the CNs of the participants */
68   isallday     INT             NULL,
69   iscycle      INT             NULL,     /* client needs to fetch to resolve */
70   ispublic     INT             NOT NULL,
71   status       INT             NOT NULL,
72   isopaque     INT             NULL,
73   priority     INT             NOT NULL, -- for marking high prio apts
74   location     VARCHAR(256)    NULL,
75   orgmail      VARCHAR(256)    NULL,
76   partmails    VARCHAR(100000) NOT NULL, /* the emails of the participants */
77   partstates   VARCHAR(256)    NOT NULL, /* the status of each participant */
78   sequence     INT             NULL      /* the iCal sequence */
79 );
80
81 CREATE TABLE SOGo_${USER_TABLE}_privcal_blob (
82   c_name         VARCHAR(256)    NOT NULL PRIMARY KEY, /* the filename */
83   c_content      VARCHAR(100000) NOT NULL, /* the BLOB */
84   c_creationdate INT             NOT NULL, /* creation date */
85   c_lastmodified INT             NOT NULL, /* last modification (UPDATE) */
86   c_version      INT             NOT NULL  /* version counter */
87 );
88
89 DROP TABLE SOGo_${USER_TABLE}_contacts_quick;
90 DROP TABLE SOGo_${USER_TABLE}_contacts_blob;
91
92 CREATE TABLE SOGo_${USER_TABLE}_contacts_quick (
93   c_name          VARCHAR(256)    NOT NULL PRIMARY KEY, /* the filename */
94   givenname       VARCHAR(256),
95   cn              VARCHAR(256),
96   sn              VARCHAR(256),
97   l               VARCHAR(256),
98   mail            VARCHAR(256),
99   o               VARCHAR(256),
100   ou              VARCHAR(256),
101   telephonenumber VARCHAR(256)
102 );
103
104 CREATE TABLE SOGo_${USER_TABLE}_contacts_blob (
105   c_name         VARCHAR(256)    NOT NULL PRIMARY KEY, /* the filename */
106   c_content      VARCHAR(100000) NOT NULL, /* the BLOB */
107   c_creationdate INT             NOT NULL, /* creation date */
108   c_lastmodified INT             NOT NULL, /* last modification (UPDATE) */
109   c_version      INT             NOT NULL  /* version counter */
110 );
111
112 EOF
113 shift
114 done