| 25 | |
| 26 | /* |
| 27 | creation des tables des stations et des barrages |
| 28 | */ |
| 29 | -- Schema: "oria" |
| 30 | |
| 31 | -- DROP SCHEMA oria; |
| 32 | |
| 33 | --CREATE SCHEMA oria AUTHORIZATION postgres; |
| 34 | |
| 35 | drop table if exists oria.estaciones_st; |
| 36 | create table oria.estaciones_st ( |
| 37 | st_id character varying(10), |
| 38 | st_ecoregion character varying(10), |
| 39 | st_river character varying(40), |
| 40 | st_name text, |
| 41 | st_x numeric, |
| 42 | st_y numeric, |
| 43 | st_z numeric, |
| 44 | st_pk_des numeric, |
| 45 | st_date date, |
| 46 | st_21fpcomun_num integer, |
| 47 | st_nha numeric); |
| 48 | alter table oria.estaciones_st add constraint pk_st_id primary key (st_id); |
| 49 | set client_encoding to 'latin1'; |
| 50 | copy oria.estaciones_st from 'c:/base/estaciones.csv' with csv delimiter as ';' header; |
| 51 | |
| 52 | drop table if exists oria.operation_op; |
| 53 | create table oria.operation_op ( |
| 54 | op_date date, |
| 55 | op_st_id character varying(10), |
| 56 | op_op_id character varying(10) primary key, |
| 57 | st_x numeric, |
| 58 | st_y numeric, |
| 59 | st_z numeric, |
| 60 | st_pk_des numeric, |
| 61 | op_surf numeric, |
| 62 | op_methodest character varying(30), |
| 63 | op_fishingobj character varying(30), |
| 64 | op_nbpas integer, |
| 65 | op_effort numeric, |
| 66 | op_densite numeric, |
| 67 | op_nbtot numeric, |
| 68 | op_nbp1 numeric, |
| 69 | op_nbp2 numeric, |
| 70 | op_nbp3 numeric, |
| 71 | op_nb150 numeric, |
| 72 | op_nb150_300 numeric, |
| 73 | op_nb300_450 numeric, |
| 74 | op_nb_450_600 numeric, |
| 75 | op_nb_600 numeric, |
| 76 | op_glass_eel_transport boolean); |
| 77 | alter table oria.operation_op add constraint fk_op_st_id foreign key (op_st_id) references oria.estaciones_st(st_id); |