
CREATE TABLE ofe_archivos (
    nid integer NOT NULL,
    fecha timestamp without time zone NOT NULL,
    nombre character varying(100) NOT NULL,
    nid_carpeta integer NOT NULL,
    datos bytea NOT NULL,
    checksum character varying(256) NOT NULL,
    nbloques integer DEFAULT 1
);

CREATE SEQUENCE ofe_archivos_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_archivos_nid_seq OWNED BY ofe_archivos.nid;


CREATE TABLE ofe_archivos_bloques (
    nid integer NOT NULL,
    nid_archivo integer NOT NULL,
    k_bloque integer,
    datos bytea NOT NULL,
    checksum character varying(256) NOT NULL
);


CREATE SEQUENCE ofe_archivos_bloques_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_archivos_bloques_nid_seq OWNED BY ofe_archivos_bloques.nid;




CREATE TABLE ofe_carpetas (
    nid integer NOT NULL,
    fecha timestamp without time zone NOT NULL,
    tipo integer NOT NULL,
    path character varying(256) NOT NULL,
    descripcion character varying(256) NOT NULL
);

CREATE SEQUENCE ofe_carpetas_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_carpetas_nid_seq OWNED BY ofe_carpetas.nid;


CREATE TABLE ofe_cnt_terminar (
    problema integer DEFAULT 0
	cnt integer DEFAULT 0,
);

ALTER TABLE public.ofe_cnt_terminar OWNER TO oddface;


CREATE TABLE ofe_estados_problema (
    nid integer NOT NULL,
    nombre character varying(8) NOT NULL,
    descripcion text NOT NULL
);
ALTER TABLE public.ofe_estados_problema OWNER TO oddface;

CREATE SEQUENCE ofe_estados_problema_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_estados_problema_nid_seq OWNED BY ofe_estados_problema.nid;


CREATE TABLE ofe_grupo_ucluster (
    grupo integer,
    ucluster character varying(12) DEFAULT NULL::character varying
);
ALTER TABLE public.ofe_grupo_ucluster OWNER TO oddface;


CREATE TABLE ofe_grupos (
    nid integer NOT NULL,
    nombre character varying(30)
);
ALTER TABLE public.ofe_grupos OWNER TO oddface;


CREATE SEQUENCE ofe_grupos_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_grupos_nid_seq OWNED BY ofe_grupos.nid;






CREATE TABLE ofe_nube_ejecutor (
    nid integer NOT NULL,
    nid_origen integer NOT NULL,
    nid_destino integer NOT NULL,
    orden text NOT NULL,
    resultado text NOT NULL,
    dt_creacion timestamp without time zone NOT NULL,
    dt_ejecucion timestamp without time zone NOT NULL,
    nid_ejecutor integer NOT NULL,
    estado integer DEFAULT 0 NOT NULL
);

CREATE SEQUENCE ofe_nube_ejecutor_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER TABLE public.ofe_nube_ejecutor_nid_seq OWNER TO oddface;
ALTER SEQUENCE ofe_nube_ejecutor_nid_seq OWNED BY ofe_nube_ejecutor.nid;


CREATE TABLE ofe_optima (
    nid integer NOT NULL,
    nid_problema integer,
    regasificadora character varying(100) DEFAULT NULL::character varying,
    largo integer
);
ALTER TABLE public.ofe_optima OWNER TO oddface;

CREATE SEQUENCE ofe_optima_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_optima_nid_seq OWNED BY ofe_optima.nid;


CREATE TABLE ofe_pam_ordenes (
    nid integer NOT NULL,
    nid_problema integer,
    nombre character varying(100) DEFAULT NULL::character varying,
    dias_parada integer,
    unidades_a_mantener integer,
    fecha_inicio date,
    fecha_fin date,
    activa smallint DEFAULT 0
);

CREATE SEQUENCE ofe_pam_ordenes_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_pam_ordenes_nid_seq OWNED BY ofe_pam_ordenes.nid;

CREATE TABLE ofe_parametros (
    nombre character varying(100) DEFAULT ''::character varying NOT NULL,
    valor character varying(200) DEFAULT NULL::character varying
);



CREATE TABLE ofe_pig_tecnologias (
    nid integer NOT NULL,
    nid_problema integer,
    nombre character varying(100) DEFAULT NULL::character varying,
    meses_construccion integer,
    anios_vida_util integer,
    musd_por_unidad double precision,
    fecha_inicio date,
    fecha_fin date,
    max_unid_por_vez integer,
    max_unid_activas integer,
    factor_unidades character varying(100) DEFAULT '1'::bpchar,
    activa smallint,
    indx_fv double precision DEFAULT 0,
    indx_tasa double precision DEFAULT 0
);

CREATE SEQUENCE ofe_pig_tecnologias_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_pig_tecnologias_nid_seq OWNED BY ofe_pig_tecnologias.nid;


CREATE TABLE ofe_problemas (
    nid integer NOT NULL,
    usuario integer,
    llave integer,
    dt_creacion timestamp without time zone DEFAULT ('now'::text)::date,
    ro_ve double precision DEFAULT (1)::double precision,
    ro_var double precision DEFAULT (0)::double precision,
    ro_cvar double precision DEFAULT (0)::double precision,
    n_cronicasporvez integer DEFAULT 10,
    n_discretizacioneshistograma integer DEFAULT 200,
    semilla_madre integer DEFAULT 31,
    ro_ga double precision DEFAULT (0.900000000000000022)::double precision,
    ro_eg double precision DEFAULT (0)::double precision,
    ro_mj double precision DEFAULT (0.100000000000000006)::double precision,
    ga_prob_premio_exito double precision DEFAULT (0.699999999999999956)::double precision,
    ga_prob_mutacion double precision DEFAULT (0.0100000000000000002)::double precision,
    descripcion text DEFAULT ''::text,
    tipo integer DEFAULT 0,
    estado integer DEFAULT 0,
    sala_simsee character varying(200) DEFAULT ''::character varying,
    fecha_primer_etapa timestamp without time zone,
    dias_por_etapa integer DEFAULT 0,
    n_etapas integer DEFAULT 0,
    cnt_terminar integer DEFAULT 0,
    ro_binary double precision DEFAULT (1)::double precision,
    ro_gray double precision DEFAULT (0)::double precision,
    ro_unary double precision DEFAULT (0)::double precision,
    ro_fosil_agosto2011 double precision DEFAULT (0)::double precision,
    grupo integer DEFAULT 0
);


CREATE SEQUENCE ofe_problemas_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_problemas_nid_seq OWNED BY ofe_problemas.nid;

CREATE TABLE ofe_redcegh_data (
    nid integer NOT NULL,
    nid_problema integer,
    data text,
    activa smallint
);

CREATE SEQUENCE ofe_redcegh_data_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_redcegh_data_nid_seq OWNED BY ofe_redcegh_data.nid;


CREATE TABLE ofe_tipo_problema_grupo (
    tipo integer NOT NULL,
    grupo integer NOT NULL
);



CREATE TABLE ofe_tipos_problema (
    nid integer NOT NULL,
    nombre character varying(100) NOT NULL,
    descripcion text NOT NULL,
    apl character varying(100) NOT NULL
);

CREATE SEQUENCE ofe_tipos_problema_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_tipos_problema_nid_seq OWNED BY ofe_tipos_problema.nid;




CREATE TABLE ofe_usuarios (
    nid integer NOT NULL,
    email character varying(60) NOT NULL,
    clave character varying(200) NOT NULL,
    tipo integer DEFAULT 0 NOT NULL,
    clavene character varying(200) NOT NULL,
    codigo character varying(20) DEFAULT ''::character varying,
    grupo integer DEFAULT 0
);

CREATE SEQUENCE ofe_usuarios_nid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE ofe_usuarios_nid_seq OWNED BY ofe_usuarios.nid;



--
-- Name: nid; Type: DEFAULT; Schema: public; Owner: oddface
--

ALTER TABLE ONLY ofe_archivos ALTER COLUMN nid SET DEFAULT nextval('ofe_archivos_nid_seq'::regclass);
ALTER TABLE ONLY ofe_archivos_bloques ALTER COLUMN nid SET DEFAULT nextval('ofe_archivos_bloques_nid_seq'::regclass);
ALTER TABLE ONLY ofe_carpetas ALTER COLUMN nid SET DEFAULT nextval('ofe_carpetas_nid_seq'::regclass);
ALTER TABLE ONLY ofe_estados_problema ALTER COLUMN nid SET DEFAULT nextval('ofe_estados_problema_nid_seq'::regclass);
ALTER TABLE ONLY ofe_grupos ALTER COLUMN nid SET DEFAULT nextval('ofe_grupos_nid_seq'::regclass);
ALTER TABLE ONLY ofe_nube_ejecutor ALTER COLUMN nid SET DEFAULT nextval('ofe_nube_ejecutor_nid_seq'::regclass);
ALTER TABLE ONLY ofe_optima ALTER COLUMN nid SET DEFAULT nextval('ofe_optima_nid_seq'::regclass);
ALTER TABLE ONLY ofe_pam_ordenes ALTER COLUMN nid SET DEFAULT nextval('ofe_pam_ordenes_nid_seq'::regclass);
ALTER TABLE ONLY ofe_parametros_vates ALTER COLUMN nid SET DEFAULT nextval('parametros_vates_nid_seq'::regclass);
ALTER TABLE ONLY ofe_pig_tecnologias ALTER COLUMN nid SET DEFAULT nextval('ofe_pig_tecnologias_nid_seq'::regclass);
ALTER TABLE ONLY ofe_problemas ALTER COLUMN nid SET DEFAULT nextval('ofe_problemas_nid_seq'::regclass);
ALTER TABLE ONLY ofe_redcegh_data ALTER COLUMN nid SET DEFAULT nextval('ofe_redcegh_data_nid_seq'::regclass);
ALTER TABLE ONLY ofe_tipos_problema ALTER COLUMN nid SET DEFAULT nextval('ofe_tipos_problema_nid_seq'::regclass);
ALTER TABLE ONLY ofe_usuarios ALTER COLUMN nid SET DEFAULT nextval('ofe_usuarios_nid_seq'::regclass);


--
-- Name: ofe_parametros_pkey; Type: CONSTRAINT; Schema: public; Owner: oddface; Tablespace: 
--

ALTER TABLE ONLY ofe_parametros
    ADD CONSTRAINT ofe_parametros_pkey PRIMARY KEY (nombre);
ALTER TABLE ONLY ofe_tipo_problema_grupo
    ADD CONSTRAINT ofe_tipo_problema_grupo_pkey PRIMARY KEY (tipo, grupo);
ALTER TABLE ONLY ofe_usuarios
    ADD CONSTRAINT ofe_usuarios_email_key UNIQUE (email);


