]> err.no Git - scalable-opengroupware.org/commitdiff
might prove to be useful for someone except me
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 12 Aug 2004 11:36:34 +0000 (11:36 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 12 Aug 2004 11:36:34 +0000 (11:36 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@186 d1b88da0-ebda-0310-925b-ed51d893ca5b

OGoContentStore/sql/generate-folderinfo-sql-for-users.sh [new file with mode: 0755]

diff --git a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh
new file mode 100755 (executable)
index 0000000..ce286ed
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+# Usage: generate-folderinfo-sql-for-users user1 [user2] [user3] [...]
+#
+
+DB_USER="postgres"
+DB_PASS=""
+DB_HOST="agenor-db"
+DB_PORT="5432"
+DB_NAME="test"
+
+
+while [ "$1" != "" ]; do
+USER_ID=$1
+USER_TABLE=`echo $USER_ID | tr -s [:punct:] _`
+cat << EOF
+--
+-- (C) 2004 SKYRIX Software AG
+--
+-- TODO:
+--   add a unique constraints on path
+
+DELETE FROM SOGo_folder_info WHERE c_path2 = "${USER_ID}";
+
+INSERT INTO SOGo_folder_info 
+  ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
+    c_location, c_quick_location, c_folder_type ) 
+VALUES 
+  ( '/Users/${USER_ID}', 
+    'Users',
+    '${USER_ID}',
+    NULL,
+    NULL,
+    '${USER_ID}', 
+    'http://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/${DB_NAME}/SOGo_user_folder', 
+    'http://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/${DB_NAME}/SOGo_user_folder_quick', 
+    'Container' );
+
+INSERT INTO SOGo_folder_info 
+  ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, 
+    c_location, c_quick_location, c_folder_type ) 
+VALUES 
+  ( '/Users/${USER_ID}/Calendar', 
+    'Users',
+    '${USER_ID}',
+    'Calendar',
+     NULL,
+    'Calendar', 
+    'http://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/${DB_NAME}/SOGo_${USER_TABLE}_privcal', 
+    'http://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/${DB_NAME}/SOGo_${USER_TABLE}_privcal_quick', 
+    'Appointment' );
+
+DROP TABLE SOGo_${USER_TABLE}_privcal_quick;
+DROP TABLE SOGo_${USER_TABLE}_privcal;
+
+CREATE TABLE SOGo_${USER_TABLE}_privcal_quick (
+  c_name       VARCHAR(256)    NOT NULL PRIMARY KEY, -- the filename
+  uid          VARCHAR(256)    NOT NULL,
+  startdate    INT             NOT NULL,
+  enddate      INT             NOT NULL,
+  title        VARCHAR(1000)   NOT NULL,
+  participants VARCHAR(100000) NOT NULL
+);
+
+CREATE TABLE SOGo_${USER_TABLE}_privcal (
+  c_name         VARCHAR(256)    NOT NULL PRIMARY KEY, -- the filename
+  c_content      VARCHAR(100000) NOT NULL, -- the BLOB
+  c_creationdate INT             NOT NULL, -- creation date
+  c_lastmodified INT             NOT NULL, -- last modification (UPDATE)
+  c_version      INT             NOT NULL  -- version counter
+);
+EOF
+shift
+done