print "Using database observations"
use observations
go

print "Creating new olas_log table"
go

Create table olas_log
(
     file_id varchar(255) not null,
     creation_date datetime not null,
     file_type tinyint not null,
     task_name varchar(50) not null,
     task_type tinyint not null,
     status char(1) not null,
     info varchar(255) null,
     ctrl_mask int not null,
     error_msg varchar(255) null
)
go

print "Creating indexes on olas_log table"
go

create unique clustered index fid_idx
	on olas_log ( file_id, task_name ) 
go

create index date_idx on olas_log ( creation_date )
go

create index tsk_idx on olas_log ( task_name )
go

grant select on olas_log to public
grant insert,update, delete on olas_log to frameingest
grant all on olas_log to archeso
go
