/*+++++++++++
.LANGUAGE       SQL
.IDENTIFICATION logdb.sql
.AUTHOR         Miguel Albrecht [ESO Archive]
.KEYWORDS       Creation of Tables
.ENVIRONMENT    Sybase, ESO Archive log database
.COMMENTS       Create tables required by the log database
.VERSION  1.0   11-Apr-1995: Creation
--------------*/

use observations
go

		/* ---- Operations Log ---- */

if exists (select * from sysobjects where name="ops_log")
	drop table ops_log
go

create table ops_log (
	log_id varchar(80) not null,	/* Log file name  	*/
	date datetime not null,		/* Log record date and time   	*/
	param varchar(60) not null,	/* Parameter being recorded	*/
	vstr varchar(80) null,		/* Value of parameter, string	*/
	vint int null,			/* Value of parameter, int 	*/
	vdouble float null,		/* Value of parameter, double	*/
	mask varchar(12) not null,	/* Source mask, if any		*/
	night smallint null,		/* Flag this record: 1=night	*/
	type char(1) null,		/* Event type                   */
	comment varchar (80) null)	/* Parameter comment		*/
go

create nonclustered index log_id on ops_log 
	(log_id)
	with fillfactor = 10
go
create clustered index log_rec_idx on ops_log 
	(date)
	with fillfactor = 100, allow_dup_row
go
create nonclustered index log_param_idx on ops_log 
	(param)
	with fillfactor = 100
go
create nonclustered index log_value_idx on ops_log 
	(vstr, vint, vdouble)
	with fillfactor = 100
go
create nonclustered index log_src_idx on ops_log 
	(mask)
	with fillfactor = 100
go

grant select on ops_log to public
grant insert on ops_log to frameingest
grant all on ops_log to archeso
go

