print "Using database observations"
use observations
go

if exists (select name from sysobjects where name = 'obs_tables' and type = 'U')
		begin
		    print "Dropping existing table obs_tables"
		    drop table obs_tables
		end
go

print "Creating table obs_tables"
Create table obs_tables
(
        name		varchar(30) not null,
	instrume	varchar(20) not null
)
go
print "Creating indices on obs_tables table"
create unique clustered index name_instrume on obs_tables (name, instrume)
go

print "Granting"
grant select on obs_tables to public
grant update on obs_tables to frameingest
go

INSERT INTO obs_tables (name,instrume) VALUES ('data_products','FORS1')
INSERT INTO obs_tables (name,instrume) VALUES ('fors1','FORS1')

INSERT INTO obs_tables (name,instrume) VALUES ('data_products','FORS2')
INSERT INTO obs_tables (name,instrume) VALUES ('fors2','FORS2')

INSERT INTO obs_tables (name,instrume) VALUES ('data_products','ISAAC')
INSERT INTO obs_tables (name,instrume) VALUES ('isaac_all','ISAAC')

INSERT INTO obs_tables (name,instrume) VALUES ('data_products','UVES')
INSERT INTO obs_tables (name,instrume) VALUES ('uves','UVES')
go
 
INSERT INTO obs_tables (name,instrume) VALUES ('data_products','WFI')
go

INSERT INTO obs_tables (name,instrume) VALUES ('data_products','NACO')
go
