2000-09-15 14:46:50 +02:00
|
|
|
------------------------------------------------------------------------------
|
|
|
|
-- Create_Tables Script for Oracle --
|
|
|
|
-- not yet completed and not yet fully working. The trigger functions still --
|
|
|
|
-- need to be built and I couldn't figure out yet how to do this... --
|
|
|
|
------------------------------------------------------------------------------
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-18 00:21:11 +02:00
|
|
|
-- $Id$
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
------------------
|
|
|
|
-- APPLICATIONS --
|
|
|
|
------------------
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
connect system/system;
|
|
|
|
|
|
|
|
CREATE TABLESPACE phpgw
|
|
|
|
DATAFILE 'diskb:tablespace_phpgw.dat' SIZE 500K REUSE
|
|
|
|
AUTOEXTEND ON NEXT 500K MAXSIZE 10M;
|
|
|
|
|
|
|
|
CREATE USER phpgw IDENTIFIED BY phpgw
|
|
|
|
DEFAULT TABLESPACE phpgw
|
|
|
|
QUOTA 10M ON phpgw;
|
|
|
|
|
|
|
|
GRANT connect TO phpgw;
|
|
|
|
|
|
|
|
GRANT dba TO phpgw;
|
|
|
|
|
|
|
|
connect phpgw/phpgw;
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
CREATE TABLE applications (
|
|
|
|
app_name varchar2(25) NOT NULL,
|
|
|
|
app_title varchar2(50),
|
2000-09-18 01:23:30 +02:00
|
|
|
app_enabled number
|
2000-09-22 17:42:45 +02:00
|
|
|
app_order int,
|
|
|
|
app_tables varchar2(255),
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
create unique index applications_app_name
|
|
|
|
on applications (app_name);
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-22 17:42:45 +02:00
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('admin', 'Administration', 1, 1, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('tts', 'Trouble Ticket System', 0, 2, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('inv', 'Inventory', 0, 3, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('chat', 'Chat', 0, 4, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('headlines', 'Headlines', 0, 5, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('filemanager', 'File manager', 1, 6, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('addressbook', 'Address Book', 1, 7, 'addressbook');
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('todo', 'ToDo List', 1, 8, 'todo');
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('calendar', 'Calendar', 1, 9, 'webcal_entry,webcal_entry_users,webcal_entry_groups,webcal_repeats');
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('email', 'Email', 1, 10,NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('nntp', 'NNTP', 1, 11, NULL);
|
|
|
|
insert into applications (app_name, app_title, app_enabled, app_order, app_tables) values ('cron_apps', 'cron_apps', 0, 0, NULL);
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
--------------
|
|
|
|
-- ACCOUNTS --
|
|
|
|
--------------
|
|
|
|
|
|
|
|
CREATE TABLE accounts (
|
2000-09-26 01:05:43 +02:00
|
|
|
account_id number NOT NULL,
|
|
|
|
account_lid varchar2(25) NOT NULL,
|
|
|
|
account_pwd varchar2(32) NOT NULL,
|
|
|
|
account_firstname varchar2(50),
|
|
|
|
account_lastname varchar2(50),
|
|
|
|
account_permissions varchar2(255),
|
|
|
|
account_groups varchar2(30),
|
|
|
|
account_lastlogin number(11),
|
|
|
|
account_lastloginfrom varchar2(255),
|
|
|
|
account_lastpwd_change number(11),
|
|
|
|
account_status varchar2(40) DEFAULT 'A' check (status in ('A','L')) NOT NULL,
|
|
|
|
PRIMARY KEY (account_id)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
create unique index accounts_loginid
|
2000-09-26 01:05:43 +02:00
|
|
|
on accounts (account_lid);
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
create sequence accounts_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger accounts_bri
|
|
|
|
before insert on accounts
|
|
|
|
for each row
|
|
|
|
begin
|
|
|
|
select accounts_seq.nextval into :new.con from dual;
|
|
|
|
end;
|
|
|
|
/
|
2000-09-15 14:46:50 +02:00
|
|
|
|
2000-09-26 01:05:43 +02:00
|
|
|
insert into accounts (account_ld,account_pwd,account_firstname,account_lastname,account_permissions,account_groups,
|
|
|
|
status) values ('demo','81dc9bdb52d04dc20036dbd8313ed055','Demo','Account',':admin:email:todo:addressbook:calendar:',',1,','A');
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
------------
|
|
|
|
-- GROUPS --
|
|
|
|
------------
|
2000-09-13 22:49:34 +02:00
|
|
|
|
|
|
|
create table groups (
|
2000-09-18 00:20:29 +02:00
|
|
|
group_id number NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
group_name varchar2(255),
|
|
|
|
group_apps varchar2(255),
|
|
|
|
primary key(group_id)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
create sequence groups_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger groups_bri
|
|
|
|
before insert on groups
|
|
|
|
for each row
|
|
|
|
begin
|
|
|
|
select groups_seq.nextval into :new.group_id from dual;
|
|
|
|
end;
|
|
|
|
/
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
insert into groups (group_name) values ('Default');
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
-----------------
|
|
|
|
-- PREFERENCES --
|
|
|
|
-----------------
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
CREATE TABLE preferences (
|
2000-09-26 01:05:43 +02:00
|
|
|
preference_owner varchar2(20),
|
|
|
|
preference_name varchar2(50),
|
|
|
|
preference_value varchar2(50)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-26 01:05:43 +02:00
|
|
|
insert into preferences values ('demo','maxmatchs','10','');
|
|
|
|
insert into preferences values ('demo','mainscreen_showbirthdays','True','');
|
|
|
|
insert into preferences values ('demo','mainscreen_showevents','True','');
|
|
|
|
insert into preferences values ('demo','timeformat','12','');
|
|
|
|
insert into preferences values ('demo','dateformat','m/d/Y','');
|
|
|
|
insert into preferences values ('demo','theme','default','');
|
|
|
|
insert into preferences values ('demo','tz_offset','0','');
|
2000-09-13 22:49:34 +02:00
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
--------------
|
|
|
|
-- SESSIONS --
|
|
|
|
--------------
|
|
|
|
|
|
|
|
CREATE TABLE sessions (
|
|
|
|
sessionid varchar2(255) NOT NULL,
|
|
|
|
loginid varchar2(20),
|
|
|
|
passwd varchar2(255),
|
|
|
|
ip varchar2(255),
|
|
|
|
logintime number(11),
|
|
|
|
dla number(11)
|
|
|
|
);
|
|
|
|
|
|
|
|
create unique index sessions_sessionid
|
|
|
|
on sessions (sessionid);
|
|
|
|
|
|
|
|
------------------
|
|
|
|
-- APP_SESSIONS --
|
|
|
|
------------------
|
|
|
|
|
|
|
|
CREATE TABLE app_sessions (
|
|
|
|
sessionid varchar2(255) NOT NULL,
|
|
|
|
loginid varchar2(20),
|
|
|
|
app varchar2(20),
|
2000-09-18 00:20:29 +02:00
|
|
|
content varchar2(2000)
|
2000-09-15 14:46:50 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
----------------
|
|
|
|
-- ACCESS_LOG --
|
|
|
|
----------------
|
|
|
|
|
2000-09-13 22:49:34 +02:00
|
|
|
create table access_log (
|
2000-09-15 14:46:50 +02:00
|
|
|
sessionid varchar2(30),
|
|
|
|
loginid varchar2(30),
|
|
|
|
ip varchar2(30),
|
2000-09-18 01:23:30 +02:00
|
|
|
li number(11),
|
|
|
|
lo number(11)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
--------------
|
|
|
|
-- PROFILES --
|
|
|
|
--------------
|
|
|
|
|
2000-09-13 22:49:34 +02:00
|
|
|
CREATE TABLE profiles (
|
2000-09-18 00:20:29 +02:00
|
|
|
con number NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
owner varchar2(20),
|
|
|
|
title varchar2(255),
|
|
|
|
phone_number varchar2(255),
|
|
|
|
comments varchar2(4000),
|
|
|
|
picture_format varchar2(255),
|
|
|
|
picture blob,
|
|
|
|
PRIMARY KEY (con)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
create sequence profiles_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger profiles_bri
|
|
|
|
before insert on profiles
|
|
|
|
for each row
|
|
|
|
begin
|
|
|
|
select profiles_seq.nextval into :new.con from dual;
|
|
|
|
end;
|
|
|
|
/
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
-----------------
|
|
|
|
-- ADDRESSBOOK --
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
CREATE TABLE addressbook (
|
2000-09-25 01:56:25 +02:00
|
|
|
ab_id number NOT NULL,
|
2000-09-18 22:00:25 +02:00
|
|
|
ab_owner varchar2(25),
|
|
|
|
ab_addr_access varchar2(10),
|
|
|
|
ab_firstname varchar2(255),
|
|
|
|
ab_lastname varchar2(255),
|
|
|
|
ab_email varchar2(255),
|
|
|
|
ab_hphone varchar2(255),
|
|
|
|
ab_wphone varchar2(255),
|
2000-09-25 01:56:25 +02:00
|
|
|
ab_fax varchar2(255),
|
2000-09-18 22:00:25 +02:00
|
|
|
ab_pager varchar2(255),
|
|
|
|
ab_mphone varchar2(255),
|
|
|
|
ab_ophone varchar2(255),
|
|
|
|
ab_street varchar2(255),
|
2000-09-25 01:56:25 +02:00
|
|
|
ab_city varchar2(255),
|
2000-09-18 22:00:25 +02:00
|
|
|
ab_state varchar2(255),
|
2000-09-25 01:56:25 +02:00
|
|
|
ab_zip varchar2(255),
|
|
|
|
ab_bday varchar2(255),
|
2000-09-18 22:00:25 +02:00
|
|
|
ab_notes varchar2(4000),
|
|
|
|
ab_company varchar2(255),
|
|
|
|
PRIMARY KEY (ab_id)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
create sequence addressbook_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger addressbook_bri
|
|
|
|
before insert on addressbook
|
|
|
|
for each row
|
|
|
|
begin
|
2000-09-25 01:56:25 +02:00
|
|
|
select addressbook_seq.nextval into :new.ab_id from dual;
|
2000-09-18 00:20:29 +02:00
|
|
|
end;
|
|
|
|
/
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
----------
|
|
|
|
-- TODO --
|
|
|
|
----------
|
|
|
|
|
|
|
|
CREATE TABLE todo (
|
2000-09-18 19:55:29 +02:00
|
|
|
todo_id number NOT NULL,
|
|
|
|
todo_owner varchar2(25),
|
2000-09-15 14:46:50 +02:00
|
|
|
todo_access varchar2(10),
|
2000-09-18 19:55:29 +02:00
|
|
|
todo_des varchar2(4000),
|
|
|
|
todo_pri number(11),
|
|
|
|
todo_status number(11),
|
|
|
|
todo_datecreated number(11),
|
|
|
|
todo_datedue number(11),
|
|
|
|
PRIMARY KEY (todo_id)
|
2000-09-15 14:46:50 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
create sequence todo_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger todo_bri
|
|
|
|
before insert on todo
|
|
|
|
for each row
|
|
|
|
begin
|
2000-09-25 01:56:25 +02:00
|
|
|
select todo_seq.nextval into :new.todo_id from dual;
|
2000-09-18 00:20:29 +02:00
|
|
|
end;
|
|
|
|
/
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
------------------
|
|
|
|
-- WEBCAL_ENTRY --
|
|
|
|
------------------
|
|
|
|
|
|
|
|
CREATE TABLE webcal_entry (
|
2000-09-18 00:20:29 +02:00
|
|
|
cal_id number NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
cal_group_id number(11),
|
|
|
|
cal_create_by varchar2(25) NOT NULL,
|
|
|
|
cal_date number(11) DEFAULT '0' NOT NULL,
|
|
|
|
cal_time number(11),
|
|
|
|
cal_mod_date number(11),
|
|
|
|
cal_mod_time number(11),
|
|
|
|
cal_duration number(11) DEFAULT '0' NOT NULL,
|
|
|
|
cal_priority number(11) DEFAULT '2',
|
|
|
|
cal_type varchar2(10),
|
|
|
|
cal_access char(10),
|
|
|
|
cal_name varchar2(80) NOT NULL,
|
|
|
|
cal_description varchar2(4000),
|
|
|
|
PRIMARY KEY (cal_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
create sequence webcal_entry_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger webcal_entry_bri
|
|
|
|
before insert on webcal_entry
|
|
|
|
for each row
|
|
|
|
begin
|
|
|
|
select webcal_entry_seq.nextval into :new.cal_id from dual;
|
|
|
|
end;
|
|
|
|
/
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
--------------------------
|
|
|
|
-- WEBCAL_ENTRY_REPEATS --
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
CREATE TABLE webcal_entry_repeats (
|
2000-09-18 00:20:29 +02:00
|
|
|
cal_id number NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
cal_type varchar2(40) DEFAULT 'daily' check (cal_type in ('daily','weekly','monthlyByDay','monthlyByDate','yearly')) NOT NULL,
|
|
|
|
cal_end number(11),
|
|
|
|
cal_frequency number(11) DEFAULT '1',
|
2000-09-13 22:49:34 +02:00
|
|
|
cal_days char(7)
|
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
------------------------
|
|
|
|
-- WEBCAL_ENTRY_USERS --
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
CREATE TABLE webcal_entry_user (
|
2000-09-18 00:20:29 +02:00
|
|
|
cal_id number NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
cal_login varchar2(25) NOT NULL,
|
|
|
|
cal_status char(1) DEFAULT 'A',
|
|
|
|
PRIMARY KEY (cal_id, cal_login)
|
|
|
|
);
|
|
|
|
|
|
|
|
-------------------------
|
|
|
|
-- WEBCAL_ENTRY_GROUPS --
|
|
|
|
-------------------------
|
|
|
|
|
2000-09-13 22:49:34 +02:00
|
|
|
create table webcal_entry_groups (
|
2000-09-18 00:20:29 +02:00
|
|
|
cal_id number not null,
|
2000-09-15 14:46:50 +02:00
|
|
|
groups varchar2(255)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
----------------
|
|
|
|
-- NEWSGROUPS --
|
|
|
|
----------------
|
|
|
|
|
2000-09-13 22:49:34 +02:00
|
|
|
CREATE TABLE newsgroups (
|
2000-09-18 00:20:29 +02:00
|
|
|
con number NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
name varchar2(255) NOT NULL,
|
|
|
|
messagecount number(11) NOT NULL,
|
|
|
|
lastmessage number(11) NOT NULL,
|
2000-09-13 22:49:34 +02:00
|
|
|
active char DEFAULT 'N' NOT NULL,
|
2000-09-15 14:46:50 +02:00
|
|
|
lastread number(11),
|
|
|
|
PRIMARY KEY (con)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
create unique index newsgroups_name
|
|
|
|
on newsgroups (name);
|
|
|
|
|
|
|
|
create sequence newsgroups_seq
|
|
|
|
increment by 1
|
|
|
|
start with 0
|
|
|
|
maxvalue 999999999
|
|
|
|
minvalue 0
|
|
|
|
nocycle
|
|
|
|
nocache;
|
|
|
|
|
2000-09-18 00:20:29 +02:00
|
|
|
create trigger newsgroups_bri
|
|
|
|
before insert on newsgroups
|
|
|
|
for each row
|
|
|
|
begin
|
|
|
|
select newsgroups_seq.nextval into :new.con from dual;
|
|
|
|
end;
|
|
|
|
/
|
2000-09-15 14:46:50 +02:00
|
|
|
|
|
|
|
---------------------
|
|
|
|
-- USERS_NEWSGOUPS --
|
|
|
|
---------------------
|
|
|
|
|
2000-09-13 22:49:34 +02:00
|
|
|
CREATE TABLE users_newsgroups (
|
2000-09-18 00:20:29 +02:00
|
|
|
owner number NOT NULL,
|
|
|
|
newsgroup number NOT NULL
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
|
|
|
|
2000-09-15 14:46:50 +02:00
|
|
|
----------
|
|
|
|
-- LANG --
|
|
|
|
----------
|
|
|
|
|
2000-09-13 22:49:34 +02:00
|
|
|
CREATE TABLE lang (
|
2000-09-15 14:46:50 +02:00
|
|
|
message_id varchar2(150) NOT NULL,
|
|
|
|
app_name varchar2(100) DEFAULT 'common' NOT NULL,
|
|
|
|
lang varchar2(5) NOT NULL,
|
|
|
|
content varchar2(4000) NOT NULL,
|
|
|
|
PRIMARY KEY (message_id,app_name,lang)
|
2000-09-13 22:49:34 +02:00
|
|
|
);
|
2000-09-18 00:20:29 +02:00
|
|
|
|
|
|
|
connect system/system;
|
|
|
|
|
|
|
|
REVOKE dba FROM phpgw;
|
|
|
|
|
|
|
|
commit;
|