-- Sequence: public.out_site_user_id_seq

-- DROP SEQUENCE public.out_site_user_id_seq;

CREATE SEQUENCE public.out_site_user_id_seq
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 11
  CACHE 1;
ALTER TABLE public.out_site_user_id_seq
  OWNER TO postgres;


-- table: public.out_site_user

-- DROP TABLE public.out_site_user;

CREATE TABLE out_site_user
(
  id bigint NOT NULL DEFAULT nextval('out_site_user_id_seq'::regclass),
  password character varying(255),
  creation_date timestamp(6) without time zone,
  id_document_type character varying(10),
  document character varying(20),
  first_name character varying(255),
  last_name character varying(255),
  telephone character varying(255),
  cellphone character varying(255),
  email character varying(255),
  address character varying(255),
  sex character varying(1),
  portal boolean,
  residencial_zone character varying(255),
  CONSTRAINT out_site_user_pkey PRIMARY KEY (id),
  CONSTRAINT "docType" FOREIGN KEY (id_document_type)
      REFERENCES document_type (id_document_type) MATCH SIMPLE
      ON UPDATE CASCADE ON DELETE RESTRICT
)
WITH (
  OIDS=FALSE
);
ALTER TABLE out_site_user
  OWNER TO postgres;
COMMENT ON TABLE out_site_user
  IS 'Tabla para credenciales de portal de pacientes y médico remitente.';
  
ALTER TABLE "public"."out_site_user"
ADD CONSTRAINT "document" UNIQUE ("document");  
  
--ALTER TABLE out_site_user
--ADD CONSTRAINT "document" UNIQUE ("document");
  
  
INSERT INTO out_site_user VALUES (1,'','2016-07-22 00:00:00','CC','999999','GENERICO','MEDICO GENERAL','','','sincorreo@correo.com','','m','0','');
