#!/usr/bin/env python
+"""
+README!!!
+
+Check the table names in
+CREATE_QUICK + CREATE_BLOB -> are the table names correct?
+"""
+
import pg
import sys
import random
# TEMPLATES
#
-CREATE_QUICK="""CREATE TABLE %(user)s_quick (
- c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename
+CREATE_QUICK="""CREATE TABLE SOGo_%(user)s_privcal_quick (
+ c_name VARCHAR(256) NOT NULL PRIMARY KEY,
uid VARCHAR(256) NOT NULL,
startdate INT NOT NULL,
enddate INT NOT NULL,
title VARCHAR(1000) NOT NULL,
participants VARCHAR(100000) NOT NULL
-);"""
+)"""
-CREATE_BLOB="""CREATE TABLE %(user)s_blob (
- 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
-);"""
+CREATE_BLOB="""CREATE TABLE SOGo_%(user)s_privcal (
+ c_name VARCHAR(256) NOT NULL PRIMARY KEY,
+ c_content VARCHAR(100000) NOT NULL,
+ c_creationdate INT NOT NULL,
+ c_lastmodified INT NOT NULL,
+ c_version INT NOT NULL
+)"""
INSERT_FOLDERINFO_USER="""INSERT INTO SOGo_folder_info
( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername,
NULL,
NULL,
'%(user)s',
- 'http://%(connection)/%(db)/SOGo_user_folder',
- 'http://%(connection)s/%(db)/SOGo_user_folder_quick',
- 'Container' );"""
+ 'http://%(connection)s/%(db)s/SOGo_user_folder',
+ 'http://%(connection)s/%(db)s/SOGo_user_folder_quick',
+ 'Container'
+)"""
INSERT_FOLDERINFO_USER_PRIVCAL="""INSERT INTO SOGo_folder_info
( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername,
'Calendar',
NULL,
'Calendar',
- 'http://%(connection)s/%(db)/SOGo_%(user)s_privcal',
- 'http://%(connection)s/%(db)/SOGo_%(user)s_privcal_quick',
- 'Appointment' );"""
+ 'http://%(connection)s/%(db)s/SOGo_%(user)s_privcal',
+ 'http://%(connection)s/%(db)s/SOGo_%(user)s_privcal_quick',
+ 'Appointment'
+)"""
#
"db" : db,
"connection" : dbConnectionMap[db],
}
-
+
con.query(CREATE_QUICK % map)
con.query(CREATE_BLOB % map)
defcon.query(INSERT_FOLDERINFO_USER % map)