diff --git a/Gemfile.lock b/Gemfile.lock index bd1b348f1..09448974b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,7 +45,7 @@ GIT GIT remote: https://gitlab.com/pasosdeJesus/msip.git - revision: 92cd4c9c67935d4743612e4ec2184a20b8d84e82 + revision: a3a4e8281a75ca159151d7edf78840aeea308869 branch: main specs: msip (2.2.0.beta4) @@ -237,14 +237,14 @@ GEM mime-types-data (3.2023.0218.1) mini_mime (1.1.2) mini_portile2 (2.8.4) - minitest (5.18.1) + minitest (5.19.0) minitest-reporters (1.6.0) ansi builder minitest (>= 5.0) ruby-progressbar msgpack (1.7.2) - net-imap (0.3.6) + net-imap (0.3.7) date net-protocol net-pop (0.1.2) @@ -280,7 +280,7 @@ GEM puma (6.3.0) nio4r (~> 2.0) racc (1.7.1) - rack (2.2.7) + rack (2.2.8) rack-test (2.1.0) rack (>= 1.3) rails (7.0.6) @@ -301,7 +301,7 @@ GEM actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.1.1) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) @@ -418,7 +418,7 @@ GEM will_paginate (3.3.1) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.9) + zeitwerk (2.6.11) PLATFORMS x86_64-openbsd @@ -481,4 +481,4 @@ DEPENDENCIES will_paginate BUNDLED WITH - 2.4.17 + 2.4.18 diff --git a/app/controllers/msip/anexos_controller.rb b/app/controllers/msip/anexos_controller.rb new file mode 100644 index 000000000..7163489ca --- /dev/null +++ b/app/controllers/msip/anexos_controller.rb @@ -0,0 +1,10 @@ +require 'date' +require 'sivel2_gen/concerns/controllers/anexos_controller' + +module Msip + class AnexosController < Msip::ModelosController + + load_and_authorize_resource class: Msip::Anexo + include Sivel2Gen::Concerns::Controllers::AnexosController + end +end diff --git a/app/controllers/sivel2_gen/anexo_casos_controller.rb b/app/controllers/sivel2_gen/anexo_casos_controller.rb new file mode 100644 index 000000000..3ea1a62fb --- /dev/null +++ b/app/controllers/sivel2_gen/anexo_casos_controller.rb @@ -0,0 +1,8 @@ +require 'sivel2_gen/concerns/controllers/anexo_casos_controller' + +module Sivel2Gen + class AnexoCasosController < ApplicationController + load_and_authorize_resource class: Sivel2Gen::AnexoCaso + include Sivel2Gen::Concerns::Controllers::AnexoCasosController + end +end diff --git a/app/models/msip/anexo.rb b/app/models/msip/anexo.rb index e315f9ca5..2ab679867 100644 --- a/app/models/msip/anexo.rb +++ b/app/models/msip/anexo.rb @@ -1,4 +1,3 @@ - require 'sivel2_gen/concerns/models/anexo' module Msip diff --git a/app/models/sivel2_gen/ability.rb b/app/models/sivel2_gen/ability.rb index fd21f586d..b0a937b8b 100644 --- a/app/models/sivel2_gen/ability.rb +++ b/app/models/sivel2_gen/ability.rb @@ -263,6 +263,7 @@ def self.initialize_sivel2_gen(habilidad, usuario = nil) habilidad.can :descarga_anexo, Msip::Anexo habilidad.can :mostrar_portada, Msip::Anexo habilidad.can :abre_anexo, Msip::Anexo + habilidad.can :manage, Sivel2Gen::AnexoCaso habilidad.can :contar, Msip::Ubicacion diff --git a/app/views/sivel2_gen/anexo_casos/create.turbo_stream.erb b/app/views/sivel2_gen/anexo_casos/create.turbo_stream.erb new file mode 100644 index 000000000..25310abcc --- /dev/null +++ b/app/views/sivel2_gen/anexo_casos/create.turbo_stream.erb @@ -0,0 +1,17 @@ +<%= simple_form_for @caso , multipart: true do |form| %> + <%= form.simple_fields_for :anexo_caso, + child_index: params[:index] do |ca_form| %> + <%= turbo_stream.replace "agregar-anexo-caso" do %> + <%= form.submit "Añadir Anexo", + formaction: sivel2_gen.crear_anexo_caso_path(ca_form.index.to_i + 1), + formmethod: :post, + formnovalidate: true, + class: 'btn btn-sm btn-primary agregar-ca', + id: "agregar-anexo-caso" %> + <% end %> + + <%= turbo_stream.append "anexo_casos_marco" do %> + <%= render "/sivel2_gen/casos/anexo_caso_campos", f: ca_form %> + <% end %> + <% end %> +<% end %> diff --git a/app/views/sivel2_gen/anexo_casos/destroy.html.erb b/app/views/sivel2_gen/anexo_casos/destroy.html.erb new file mode 100644 index 000000000..eadba1fc5 --- /dev/null +++ b/app/views/sivel2_gen/anexo_casos/destroy.html.erb @@ -0,0 +1,9 @@ +<%= fields model: @caso do |form| %> + <%= form.simple_fields_for :anexo_caso, + child_index: params[:index] do |ca_form| %> + <%= turbo_frame_tag "anexo_caso_#{ca_form.index}" do %> + <%= ca_form.hidden_field :id, value: params[:id] %> + <%= ca_form.hidden_field :_destroy, value: true %> + <% end %> + <% end %> +<% end %> diff --git a/app/views/sivel2_gen/casos/_anexo_caso_campos.html.erb b/app/views/sivel2_gen/casos/_anexo_caso_campos.html.erb index ccbb57b8c..03ca65088 100644 --- a/app/views/sivel2_gen/casos/_anexo_caso_campos.html.erb +++ b/app/views/sivel2_gen/casos/_anexo_caso_campos.html.erb @@ -1,43 +1,54 @@ -
-
- <% f.object.msip_anexo = Msip::Anexo.new if !f.object.msip_anexo %> +<%= turbo_frame_tag "anexo_caso_#{f.index}" do %> +
+
+ <% if f.object.msip_anexo.nil? %> + <% f.object.msip_anexo = Msip::Anexo.new %> + <% end %> + <%= f.simple_fields_for :msip_anexo, :html => {:multipart => true} do |a| %> +
+
+ <%= a.input :id, as: :hidden %> + <%= f.input :fecha, + :input_html => { type: "date" }, + :as => :string, + :label => "Fecha" %> +
- <%= f.simple_fields_for :msip_anexo do |a| %> - -
-
- <%= f.input :fecha_localizada, - :input_html => { "data-behaviour" => "datepicker" }, - :as => :string, :label => "Fecha" %> +
+ <% if !a.object || !a.object.adjunto_file_name || !a.object.id %> + <%= a.input :adjunto, as: :file, + label: 'Archivo', + data: { + disable_with: false } %> + <% else %> + + <% end %> +
-
- <% if !a.object || !a.object.adjunto_file_name || !a.object.id %> - <%= a.input :adjunto, as: :file, label: 'Archivo' %> - <% else %> - - <% end %> -
- -
- - <%= a.input :descripcion %> + <%= a.input :descripcion %> + <%= a.input :id, as: :hidden %> + <% end %> - <%= a.input :id, as: :hidden %> - <% end %> - <%= link_to_remove_association "Eliminar Anexo", f, - :class => 'btn btn-sm btn-danger', - style: 'margin-bottom: 1em' - %> + <%= f.submit "Eliminar", + formaction: eliminar_anexo_caso_path(id: f.object.id, index: f.index), + formmethod: :delete, + formnovalidate: true, + class: 'btn btn-sm btn-danger', + data: { + turbo_frame: "anexo_caso_#{f.index}", + disable_with: false + } %> +
-
+<% end %> diff --git a/app/views/sivel2_gen/casos/_anexos.html.erb b/app/views/sivel2_gen/casos/_anexos.html.erb index abbf4a9a0..ab9257a2f 100644 --- a/app/views/sivel2_gen/casos/_anexos.html.erb +++ b/app/views/sivel2_gen/casos/_anexos.html.erb @@ -1,9 +1,17 @@ -<%= f.simple_fields_for :anexo_caso do |anexo| %> - <%= render 'sivel2_gen/casos/anexo_caso_campos', :f => anexo %> -<% end %> +
+ <%= f.simple_fields_for :anexo_caso, child_index: params[:index] do |anexo| %> + <%= render 'sivel2_gen/casos/anexo_caso_campos', :f => anexo %> + <% end %> +
+ diff --git a/app/views/sivel2_gen/casos/_form.html.erb b/app/views/sivel2_gen/casos/_form.html.erb index aa3f2304f..b7a5f48d3 100644 --- a/app/views/sivel2_gen/casos/_form.html.erb +++ b/app/views/sivel2_gen/casos/_form.html.erb @@ -10,6 +10,7 @@ <% @pestanas_formulariocaso = controller.pestanas_formulariocaso %> <%= simple_form_for @caso, url: sivel2_gen.casos_path(@caso).sub(/\./,"/"), + multipart: true, html: { class: 'form-horizontal', "data-controller": "msip--bitacoraap", diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 5eedbe121..94ba7f59e 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -20,6 +20,7 @@ inflect.irregular 'caso_fuenteprensa', 'caso_fuentesprensa' # Tocó porque no permite otro plural inflect.irregular 'caso_fotra', 'caso_fotras' # Tocó porque no permite otro plural inflect.irregular 'caso_presponsable', 'caso_presponsables' # Tocó porque no permite otro plural + inflect.irregular 'caso_anexo', 'caso_anexos' # Tocó porque no permite otro plural inflect.irregular 'clase', 'clases' inflect.irregular 'contextovictima', 'contextosvictima' inflect.irregular 'estadocivil', 'estadosciviles' diff --git a/config/routes.rb b/config/routes.rb index 340d9f2de..aa140e240 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,6 +91,13 @@ end end + resources :anexo_casos, only: [], param: :index do + member do + delete '(:id)', to: "anexo_casos#destroy", as: "eliminar" + post '/' => "anexo_casos#create", as: "crear" + end + end + resources :caso_fuentesprensa, only: [], param: :index do member do delete '(:id)', to: "caso_fuentesprensa#destroy", as: "eliminar" diff --git a/lib/sivel2_gen/concerns/controllers/anexo_casos_controller.rb b/lib/sivel2_gen/concerns/controllers/anexo_casos_controller.rb new file mode 100644 index 000000000..c683b5184 --- /dev/null +++ b/lib/sivel2_gen/concerns/controllers/anexo_casos_controller.rb @@ -0,0 +1,50 @@ +require 'date' + +module Sivel2Gen + module Concerns + module Controllers + module AnexoCasosController + extend ActiveSupport::Concern + + included do + include ActionView::Helpers::AssetUrlHelper + + load_and_authorize_resource class: Sivel2Gen::AnexoCaso + + before_action :prepara_caso + + def clase + "Sivel2Gen::AnexoCaso" + end + + + def nuevo + end + + def destroy + end + + def create + end + + def update + end + + def set_anexo_caso + @anexocaso = Sivel2Gen::AnexoCaso.find(params[:id]) + @registro = @anexocaso + end + + private + + def prepara_caso + @caso = Sivel2Gen::Caso.new( + anexo_caso: [Sivel2Gen::AnexoCaso.new]) + end + end # included + + end + end + end +end + diff --git a/lib/sivel2_gen/concerns/controllers/anexos_controller.rb b/lib/sivel2_gen/concerns/controllers/anexos_controller.rb new file mode 100644 index 000000000..a8a2272b8 --- /dev/null +++ b/lib/sivel2_gen/concerns/controllers/anexos_controller.rb @@ -0,0 +1,30 @@ + +require 'msip/concerns/controllers/anexos_controller' +require 'date' + +module Sivel2Gen + module Concerns + module Controllers + module AnexosController + extend ActiveSupport::Concern + + included do + include Msip::Concerns::Controllers::AnexosController + + def remplazar_antes_salvar_v + true + end + + def remplazar_despues_salvar_v + true + end + + end # included + + + class_methods do + end # class_methods + end + end + end +end diff --git a/lib/sivel2_gen/concerns/controllers/casos_controller.rb b/lib/sivel2_gen/concerns/controllers/casos_controller.rb index 0f0f270c2..f129682a1 100644 --- a/lib/sivel2_gen/concerns/controllers/casos_controller.rb +++ b/lib/sivel2_gen/concerns/controllers/casos_controller.rb @@ -806,6 +806,7 @@ def update_gen if params[:_msip_enviarautomatico] == "1" params_finales = caso_params.except( :caso_etiqueta_attributes, + :caso_anexo_attributes, :caso_fuenteprensa_attributes, :caso_fotra_attributes, :caso_presponsable_attributes @@ -1209,6 +1210,7 @@ def lista_params_sivel2_gen :anexo_caso_attributes => [ :id, :caso_id, + :anexo_id, :fecha, :fecha_localizada, :_destroy, diff --git a/lib/sivel2_gen/concerns/models/anexo.rb b/lib/sivel2_gen/concerns/models/anexo.rb index 1da83d36b..add47603f 100644 --- a/lib/sivel2_gen/concerns/models/anexo.rb +++ b/lib/sivel2_gen/concerns/models/anexo.rb @@ -9,10 +9,11 @@ module Anexo include Msip::Concerns::Models::Anexo included do + has_many :anexo_caso, foreign_key: "anexo_id", validate: true, class_name: 'Sivel2Gen::AnexoCaso' has_many :caso, class_name: 'Sivel2Gen::Caso', - through: :anexo_caso + through: :anexo_caso, inverse_of: :msip_anexo end module ClassMethods diff --git a/lib/sivel2_gen/concerns/models/anexo_caso.rb b/lib/sivel2_gen/concerns/models/anexo_caso.rb index b3aa09830..e22917a7a 100644 --- a/lib/sivel2_gen/concerns/models/anexo_caso.rb +++ b/lib/sivel2_gen/concerns/models/anexo_caso.rb @@ -10,6 +10,8 @@ module AnexoCaso include Msip::Localizacion include Msip::FormatoFechaHelper + self.table_name = 'sivel2_gen_anexo_caso' + belongs_to :caso, foreign_key: "caso_id", validate: true, class_name: "Sivel2Gen::Caso", inverse_of: :anexo_caso, optional: false diff --git a/test/dummy/app/javascript/controllers/index.js b/test/dummy/app/javascript/controllers/index.js index b275e8dc2..06f7e1481 100644 --- a/test/dummy/app/javascript/controllers/index.js +++ b/test/dummy/app/javascript/controllers/index.js @@ -4,6 +4,9 @@ import { application } from "./application" +import Msip__BitacoraapController from "./msip/bitacoraap_controller" +application.register("msip--bitacoraap", Msip__BitacoraapController) + import Msip__CancelarVacioEsEliminarController from "./msip/cancelar_vacio_es_eliminar_controller" application.register("msip--cancelar-vacio-es-eliminar", Msip__CancelarVacioEsEliminarController) diff --git a/test/dummy/db/structure.sql b/test/dummy/db/structure.sql index 68f20fc32..e30d811c3 100644 --- a/test/dummy/db/structure.sql +++ b/test/dummy/db/structure.sql @@ -461,22 +461,546 @@ SET default_tablespace = ''; SET default_table_access_method = heap; -- --- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- Name: apo214_asisreconocimiento; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_asisreconocimiento ( + id bigint NOT NULL, + lugarpreliminar_id integer, + persona_id integer, + organizacion character varying(5000), + posicion integer +); + + +-- +-- Name: apo214_asisreconocimiento_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_asisreconocimiento_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_asisreconocimiento_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_asisreconocimiento_id_seq OWNED BY public.apo214_asisreconocimiento.id; + + +-- +-- Name: apo214_cobertura; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_cobertura ( + id bigint NOT NULL, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + observaciones character varying(5000), + fechacreacion date NOT NULL, + fechadeshabilitacion date, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_cobertura_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_cobertura_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_cobertura_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_cobertura_id_seq OWNED BY public.apo214_cobertura.id; + + +-- +-- Name: apo214_disposicioncadaveres; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_disposicioncadaveres ( + id bigint NOT NULL, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + observaciones character varying(5000), + fechacreacion date NOT NULL, + fechadeshabilitacion date, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_disposicioncadaveres_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_disposicioncadaveres_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_disposicioncadaveres_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_disposicioncadaveres_id_seq OWNED BY public.apo214_disposicioncadaveres.id; + + +-- +-- Name: apo214_elementopaisaje; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_elementopaisaje ( + id bigint NOT NULL, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + observaciones character varying(5000), + fechacreacion date NOT NULL, + fechadeshabilitacion date, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_elementopaisaje_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_elementopaisaje_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_elementopaisaje_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_elementopaisaje_id_seq OWNED BY public.apo214_elementopaisaje.id; + + +-- +-- Name: apo214_evaluacionriesgo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_evaluacionriesgo ( + id bigint NOT NULL, + riesgo_id integer, + descripcion character varying(5000), + calificacion integer +); + + +-- +-- Name: apo214_evaluacionriesgo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_evaluacionriesgo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_evaluacionriesgo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_evaluacionriesgo_id_seq OWNED BY public.apo214_evaluacionriesgo.id; + + +-- +-- Name: apo214_infoanomalia; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_infoanomalia ( + id bigint NOT NULL, + anomalia character varying(100), + descripcion character varying(5000), + latitud double precision, + longitud double precision, + area character varying(1024), + anexo_id integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_infoanomalia_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_infoanomalia_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_infoanomalia_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_infoanomalia_id_seq OWNED BY public.apo214_infoanomalia.id; + + +-- +-- Name: apo214_infoanomalialugar; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_infoanomalialugar ( + id bigint NOT NULL, + lugarpreliminar_id integer NOT NULL, + infoanomalia_id integer NOT NULL +); + + +-- +-- Name: apo214_infoanomalialugar_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_infoanomalialugar_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_infoanomalialugar_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_infoanomalialugar_id_seq OWNED BY public.apo214_infoanomalialugar.id; + + +-- +-- Name: apo214_listaanexo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_listaanexo ( + id bigint NOT NULL, + fecha date, + lugarpreliminar_id integer NOT NULL, + anexo_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_listaanexo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_listaanexo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_listaanexo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_listaanexo_id_seq OWNED BY public.apo214_listaanexo.id; + + +-- +-- Name: apo214_listadepositados; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_listadepositados ( + id bigint NOT NULL, + lugarpreliminar_id integer NOT NULL, + persona_id integer NOT NULL +); + + +-- +-- Name: apo214_listadepositados_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_listadepositados_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_listadepositados_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_listadepositados_id_seq OWNED BY public.apo214_listadepositados.id; + + +-- +-- Name: apo214_listaevariesgo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_listaevariesgo ( + id bigint NOT NULL, + lugarpreliminar_id integer NOT NULL, + evaluacionriesgo_id integer NOT NULL +); + + +-- +-- Name: apo214_listaevariesgo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_listaevariesgo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_listaevariesgo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_listaevariesgo_id_seq OWNED BY public.apo214_listaevariesgo.id; + + +-- +-- Name: apo214_listainfofoto; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_listainfofoto ( + id bigint NOT NULL, + fecha date, + lugarpreliminar_id integer NOT NULL, + anexo_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_listainfofoto_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_listainfofoto_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_listainfofoto_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_listainfofoto_id_seq OWNED BY public.apo214_listainfofoto.id; + + +-- +-- Name: apo214_listapersofuentes; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_listapersofuentes ( + id bigint NOT NULL, + lugarpreliminar_id integer NOT NULL, + persona_id integer NOT NULL, + telefono character varying(1000), + observacion character varying(5000) +); + + +-- +-- Name: apo214_listapersofuentes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_listapersofuentes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_listapersofuentes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_listapersofuentes_id_seq OWNED BY public.apo214_listapersofuentes.id; + + +-- +-- Name: apo214_listasuelo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_listasuelo ( + id bigint NOT NULL, + lugarpreliminar_id integer NOT NULL, + suelo_id integer NOT NULL +); + + +-- +-- Name: apo214_listasuelo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_listasuelo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_listasuelo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_listasuelo_id_seq OWNED BY public.apo214_listasuelo.id; + + +-- +-- Name: apo214_lugarpreliminar; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_lugarpreliminar ( + id bigint NOT NULL, + fecha date, + codigositio character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + nombreusuario character varying, + organizacion character varying, + ubicacionpre_id integer, + id_persona integer, + parentezco character varying, + grabacion boolean, + telefono character varying, + tipotestigo_id integer, + otrotipotestigo character varying, + hechos text, + ubicaespecifica text, + disposicioncadaveres_id integer, + otradisposicioncadaveres character varying(1000), + tipoentierro_id integer, + min_depositados integer, + max_depositados integer, + fechadis date, + horadis time without time zone, + insitu boolean, + otrolubicacionpre_id integer, + detallesasesinato character varying(5000), + nombrepropiedad character varying(5000), + detallesdisposicion character varying(5000), + nomcomoseconoce character varying(1000), + elementopaisaje_id integer, + cobertura_id integer, + interatroprevias character varying(5000), + interatroactuales character varying(5000), + usoterprevios character varying(5000), + usoteractuales character varying(5000), + accesolugar character varying(5000), + perfilestratigrafico character varying(5000), + observaciones character varying(5000), + procesoscul character varying(5000), + desgenanomalia character varying(5000), + evaluacionlugar character varying(5000), + riesgosdanios character varying(500), + archivokml_id integer +); + + +-- +-- Name: apo214_lugarpreliminar_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_lugarpreliminar_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_lugarpreliminar_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_lugarpreliminar_id_seq OWNED BY public.apo214_lugarpreliminar.id; + + +-- +-- Name: apo214_propietario; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_propietario ( + id bigint NOT NULL, + id_lugarpreliminar integer, + id_persona integer, + telefono character varying, + observaciones character varying(5000) +); + + +-- +-- Name: apo214_propietario_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE TABLE public.ar_internal_metadata ( - key character varying NOT NULL, - value character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL +CREATE SEQUENCE public.apo214_propietario_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_propietario_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_propietario_id_seq OWNED BY public.apo214_propietario.id; + + +-- +-- Name: apo214_riesgo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_riesgo ( + id bigint NOT NULL, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + observaciones character varying(5000), + fechacreacion date NOT NULL, + fechadeshabilitacion date, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL ); -- --- Name: msip_persona_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: apo214_riesgo_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.msip_persona_id_seq +CREATE SEQUENCE public.apo214_riesgo_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -485,29 +1009,124 @@ CREATE SEQUENCE public.msip_persona_id_seq -- --- Name: msip_persona; Type: TABLE; Schema: public; Owner: - +-- Name: apo214_riesgo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -CREATE TABLE public.msip_persona ( - id integer DEFAULT nextval('public.msip_persona_id_seq'::regclass) NOT NULL, - nombres character varying(100) NOT NULL COLLATE public.es_co_utf_8, - apellidos character varying(100) NOT NULL COLLATE public.es_co_utf_8, - anionac integer, - mesnac integer, - dianac integer, - sexo character(1) NOT NULL, - numerodocumento character varying(100), - created_at timestamp without time zone, - updated_at timestamp without time zone, - pais_id integer, - nacionalde integer, - tdocumento_id integer, - departamento_id integer, - municipio_id integer, - clase_id integer, - CONSTRAINT persona_check CHECK (((dianac IS NULL) OR (((dianac >= 1) AND (((mesnac = 1) OR (mesnac = 3) OR (mesnac = 5) OR (mesnac = 7) OR (mesnac = 8) OR (mesnac = 10) OR (mesnac = 12)) AND (dianac <= 31))) OR (((mesnac = 4) OR (mesnac = 6) OR (mesnac = 9) OR (mesnac = 11)) AND (dianac <= 30)) OR ((mesnac = 2) AND (dianac <= 29))))), - CONSTRAINT persona_mesnac_check CHECK (((mesnac IS NULL) OR ((mesnac >= 1) AND (mesnac <= 12)))), - CONSTRAINT persona_sexo_check CHECK (((sexo = 'S'::bpchar) OR (sexo = 'F'::bpchar) OR (sexo = 'M'::bpchar))) +ALTER SEQUENCE public.apo214_riesgo_id_seq OWNED BY public.apo214_riesgo.id; + + +-- +-- Name: apo214_suelo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_suelo ( + id bigint NOT NULL, + profinicial character varying(100), + proffinal character varying(100), + color character varying(100), + textura character varying(100), + humedad character varying(100), + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_suelo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_suelo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_suelo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_suelo_id_seq OWNED BY public.apo214_suelo.id; + + +-- +-- Name: apo214_tipoentierro; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_tipoentierro ( + id bigint NOT NULL, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + observaciones character varying(5000), + fechacreacion date NOT NULL, + fechadeshabilitacion date, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_tipoentierro_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_tipoentierro_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_tipoentierro_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_tipoentierro_id_seq OWNED BY public.apo214_tipoentierro.id; + + +-- +-- Name: apo214_tipotestigo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.apo214_tipotestigo ( + id bigint NOT NULL, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + observaciones character varying(5000), + fechacreacion date NOT NULL, + fechadeshabilitacion date, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: apo214_tipotestigo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.apo214_tipotestigo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: apo214_tipotestigo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.apo214_tipotestigo_id_seq OWNED BY public.apo214_tipotestigo.id; + + +-- +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ar_internal_metadata ( + key character varying NOT NULL, + value character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL ); @@ -590,19 +1209,18 @@ CREATE TABLE public.sivel2_gen_victima ( -- CREATE VIEW public.cben1 AS - SELECT caso.id AS caso_id, - subv.victima_id, - subv.persona_id, + SELECT caso.id AS id_caso, + subv.id_victima, + subv.id_persona, 1 AS npersona, 'total'::text AS total FROM public.sivel2_gen_caso caso, public.sivel2_gen_victima victima, - ( SELECT sivel2_gen_victima.persona_id, - max(sivel2_gen_victima.id) AS victima_id + ( SELECT sivel2_gen_victima.persona_id AS id_persona, + max(sivel2_gen_victima.id) AS id_victima FROM public.sivel2_gen_victima - GROUP BY sivel2_gen_victima.persona_id) subv, - public.msip_persona persona - WHERE ((subv.victima_id = victima.id) AND (caso.id = victima.caso_id) AND (persona.id = victima.persona_id)); + GROUP BY sivel2_gen_victima.persona_id) subv + WHERE ((caso.fecha >= '1999-12-25'::date) AND (caso.fecha <= '1999-12-25'::date) AND (subv.id_victima = victima.id) AND (caso.id = victima.caso_id)); -- @@ -772,22 +1390,19 @@ CREATE TABLE public.msip_ubicacion ( -- CREATE VIEW public.cben2 AS - SELECT cben1.caso_id, - cben1.victima_id, - cben1.persona_id, + SELECT cben1.id_caso, + cben1.id_victima, + cben1.id_persona, cben1.npersona, cben1.total, - ubicacion.departamento_id, - departamento.deplocal_cod AS departamento_divipola, + ubicacion.departamento_id AS id_departamento, departamento.nombre AS departamento_nombre, - ubicacion.municipio_id, - ((departamento.deplocal_cod * 1000) + municipio.munlocal_cod) AS municipio_divipola, + ubicacion.municipio_id AS id_municipio, municipio.nombre AS municipio_nombre, - ubicacion.clase_id, - clase.clalocal_cod AS clase_divipola, + ubicacion.clase_id AS id_clase, clase.nombre AS clase_nombre FROM (((((public.cben1 - JOIN public.sivel2_gen_caso caso ON ((cben1.caso_id = caso.id))) + JOIN public.sivel2_gen_caso caso ON ((cben1.id_caso = caso.id))) LEFT JOIN public.msip_ubicacion ubicacion ON ((caso.ubicacion_id = ubicacion.id))) LEFT JOIN public.msip_departamento departamento ON ((ubicacion.departamento_id = departamento.id))) LEFT JOIN public.msip_municipio municipio ON ((ubicacion.municipio_id = municipio.id))) @@ -2139,6 +2754,45 @@ CREATE SEQUENCE public.msip_perfilorgsocial_id_seq ALTER SEQUENCE public.msip_perfilorgsocial_id_seq OWNED BY public.msip_perfilorgsocial.id; +-- +-- Name: msip_persona_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.msip_persona_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: msip_persona; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.msip_persona ( + id integer DEFAULT nextval('public.msip_persona_id_seq'::regclass) NOT NULL, + nombres character varying(100) NOT NULL COLLATE public.es_co_utf_8, + apellidos character varying(100) NOT NULL COLLATE public.es_co_utf_8, + anionac integer, + mesnac integer, + dianac integer, + sexo character(1) NOT NULL, + numerodocumento character varying(100), + created_at timestamp without time zone, + updated_at timestamp without time zone, + pais_id integer, + nacionalde integer, + tdocumento_id integer, + departamento_id integer, + municipio_id integer, + clase_id integer, + CONSTRAINT persona_check CHECK (((dianac IS NULL) OR (((dianac >= 1) AND (((mesnac = 1) OR (mesnac = 3) OR (mesnac = 5) OR (mesnac = 7) OR (mesnac = 8) OR (mesnac = 10) OR (mesnac = 12)) AND (dianac <= 31))) OR (((mesnac = 4) OR (mesnac = 6) OR (mesnac = 9) OR (mesnac = 11)) AND (dianac <= 30)) OR ((mesnac = 2) AND (dianac <= 29))))), + CONSTRAINT persona_mesnac_check CHECK (((mesnac IS NULL) OR ((mesnac >= 1) AND (mesnac <= 12)))), + CONSTRAINT persona_sexo_check CHECK (((sexo = 'S'::bpchar) OR (sexo = 'F'::bpchar) OR (sexo = 'M'::bpchar))) +); + + -- -- Name: msip_persona_trelacion_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -2647,6 +3301,33 @@ CREATE SEQUENCE public.sivel2_gen_actividadoficio_id_seq ALTER SEQUENCE public.sivel2_gen_actividadoficio_id_seq OWNED BY public.sivel2_gen_actividadoficio.id; +-- +-- Name: sivel2_gen_acto_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sivel2_gen_acto_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sivel2_gen_acto; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivel2_gen_acto ( + presponsable_id integer NOT NULL, + categoria_id integer NOT NULL, + persona_id integer NOT NULL, + caso_id integer NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + id integer DEFAULT nextval('public.sivel2_gen_acto_id_seq'::regclass) NOT NULL +); + + -- -- Name: sivel2_gen_actocolectivo_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -2987,36 +3668,6 @@ CREATE SEQUENCE public.sivel2_gen_caso_solicitud_id_seq ALTER SEQUENCE public.sivel2_gen_caso_solicitud_id_seq OWNED BY public.sivel2_gen_caso_solicitud.id; --- --- Name: sivel2_gen_caso_ubicacionpre; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.sivel2_gen_caso_ubicacionpre ( - id bigint NOT NULL, - caso_id integer, - ubicacionpre_id integer -); - - --- --- Name: sivel2_gen_caso_ubicacionpre_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.sivel2_gen_caso_ubicacionpre_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: sivel2_gen_caso_ubicacionpre_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.sivel2_gen_caso_ubicacionpre_id_seq OWNED BY public.sivel2_gen_caso_ubicacionpre.id; - - -- -- Name: sivel2_gen_caso_usuario; Type: TABLE; Schema: public; Owner: - -- @@ -3030,6 +3681,27 @@ CREATE TABLE public.sivel2_gen_caso_usuario ( ); +-- +-- Name: sivel2_gen_categoria; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivel2_gen_categoria ( + id integer NOT NULL, + fechacreacion date DEFAULT CURRENT_DATE NOT NULL, + fechadeshabilitacion date, + pconsolidado_id integer, + contadaen integer, + tipocat character(1) DEFAULT 'I'::bpchar, + nombre character varying(500) COLLATE public.es_co_utf_8, + created_at timestamp without time zone, + updated_at timestamp without time zone, + observaciones character varying(5000), + supracategoria_id integer, + CONSTRAINT "$3" CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))), + CONSTRAINT categoria_tipocat_check CHECK (((tipocat = 'I'::bpchar) OR (tipocat = 'C'::bpchar) OR (tipocat = 'O'::bpchar))) +); + + -- -- Name: sivel2_gen_combatiente; Type: TABLE; Schema: public; Owner: - -- @@ -3458,80 +4130,6 @@ CREATE TABLE public.sivel2_gen_iglesia ( ); --- --- Name: usuario_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.usuario_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: usuario; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.usuario ( - nusuario character varying(15) NOT NULL, - nombre character varying(50) COLLATE public.es_co_utf_8, - descripcion character varying(50), - rol integer DEFAULT 4, - password character varying(64) DEFAULT ''::character varying, - idioma character varying(6) DEFAULT 'es_CO'::character varying NOT NULL, - id integer DEFAULT nextval('public.usuario_id_seq'::regclass) NOT NULL, - fechacreacion date DEFAULT CURRENT_DATE NOT NULL, - fechadeshabilitacion date, - email character varying(255) DEFAULT ''::character varying NOT NULL, - encrypted_password character varying(255) DEFAULT ''::character varying NOT NULL, - sign_in_count integer DEFAULT 0 NOT NULL, - failed_attempts integer, - unlock_token character varying(64), - locked_at timestamp without time zone, - reset_password_token character varying, - reset_password_sent_at timestamp without time zone, - remember_created_at timestamp without time zone, - current_sign_in_at timestamp without time zone, - last_sign_in_at timestamp without time zone, - current_sign_in_ip character varying, - last_sign_in_ip character varying, - created_at timestamp without time zone, - updated_at timestamp without time zone, - oficina_id integer, - tema_id integer, - observadorffechaini date, - observadorffechafin date, - CONSTRAINT usuario_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))), - CONSTRAINT usuario_rol_check CHECK ((rol >= 1)) -); - - --- --- Name: sivel2_gen_iniciador; Type: VIEW; Schema: public; Owner: - --- - -CREATE VIEW public.sivel2_gen_iniciador AS - SELECT s3.caso_id, - s3.fechainicio, - s3.usuario_id, - usuario.nusuario - FROM public.usuario, - ( SELECT s2.caso_id, - s2.fechainicio, - min(s2.usuario_id) AS usuario_id - FROM public.sivel2_gen_caso_usuario s2, - ( SELECT f1.caso_id, - min(f1.fechainicio) AS m - FROM public.sivel2_gen_caso_usuario f1 - GROUP BY f1.caso_id) c - WHERE ((s2.caso_id = c.caso_id) AND (s2.fechainicio = c.m)) - GROUP BY s2.caso_id, s2.fechainicio - ORDER BY s2.caso_id, s2.fechainicio) s3 - WHERE (usuario.id = s3.usuario_id); - - -- -- Name: sivel2_gen_intervalo_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -3694,6 +4292,35 @@ CREATE TABLE public.sivel2_gen_pconsolidado ( ); +-- +-- Name: sivel2_gen_presponsable_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sivel2_gen_presponsable_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sivel2_gen_presponsable; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivel2_gen_presponsable ( + id integer DEFAULT nextval('public.sivel2_gen_presponsable_id_seq'::regclass) NOT NULL, + fechacreacion date DEFAULT CURRENT_DATE NOT NULL, + fechadeshabilitacion date, + papa_id integer, + nombre character varying(500) COLLATE public.es_co_utf_8, + created_at timestamp without time zone, + updated_at timestamp without time zone, + observaciones character varying(5000), + CONSTRAINT presuntos_responsables_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) +); + + -- -- Name: sivel2_gen_profesion_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -3883,6 +4510,36 @@ CREATE TABLE public.sivel2_gen_sectorsocialsec_victima ( ); +-- +-- Name: sivel2_gen_supracategoria_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sivel2_gen_supracategoria_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sivel2_gen_supracategoria; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivel2_gen_supracategoria ( + codigo integer, + nombre character varying(500) NOT NULL COLLATE public.es_co_utf_8, + fechacreacion date NOT NULL, + fechadeshabilitacion date, + tviolencia_id character varying(1) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + observaciones character varying(5000), + id integer DEFAULT nextval('public.sivel2_gen_supracategoria_id_seq'::regclass) NOT NULL, + CONSTRAINT supracategoria_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) +); + + -- -- Name: sivel2_gen_tviolencia; Type: TABLE; Schema: public; Owner: - -- @@ -3965,6 +4622,189 @@ CREATE TABLE public.sivel2_gen_vinculoestado ( ); +-- +-- Name: usuario_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.usuario_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: usuario; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.usuario ( + nusuario character varying(15) NOT NULL, + nombre character varying(50) COLLATE public.es_co_utf_8, + descripcion character varying(50), + rol integer DEFAULT 4, + password character varying(64) DEFAULT ''::character varying, + idioma character varying(6) DEFAULT 'es_CO'::character varying NOT NULL, + id integer DEFAULT nextval('public.usuario_id_seq'::regclass) NOT NULL, + fechacreacion date DEFAULT CURRENT_DATE NOT NULL, + fechadeshabilitacion date, + email character varying(255) DEFAULT ''::character varying NOT NULL, + encrypted_password character varying(255) DEFAULT ''::character varying NOT NULL, + sign_in_count integer DEFAULT 0 NOT NULL, + failed_attempts integer, + unlock_token character varying(64), + locked_at timestamp without time zone, + reset_password_token character varying, + reset_password_sent_at timestamp without time zone, + remember_created_at timestamp without time zone, + current_sign_in_at timestamp without time zone, + last_sign_in_at timestamp without time zone, + current_sign_in_ip character varying, + last_sign_in_ip character varying, + created_at timestamp without time zone, + updated_at timestamp without time zone, + oficina_id integer, + tema_id integer, + observadorffechaini date, + observadorffechafin date, + CONSTRAINT usuario_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))), + CONSTRAINT usuario_rol_check CHECK ((rol >= 1)) +); + + +-- +-- Name: apo214_asisreconocimiento id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_asisreconocimiento ALTER COLUMN id SET DEFAULT nextval('public.apo214_asisreconocimiento_id_seq'::regclass); + + +-- +-- Name: apo214_cobertura id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_cobertura ALTER COLUMN id SET DEFAULT nextval('public.apo214_cobertura_id_seq'::regclass); + + +-- +-- Name: apo214_disposicioncadaveres id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_disposicioncadaveres ALTER COLUMN id SET DEFAULT nextval('public.apo214_disposicioncadaveres_id_seq'::regclass); + + +-- +-- Name: apo214_elementopaisaje id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_elementopaisaje ALTER COLUMN id SET DEFAULT nextval('public.apo214_elementopaisaje_id_seq'::regclass); + + +-- +-- Name: apo214_evaluacionriesgo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_evaluacionriesgo ALTER COLUMN id SET DEFAULT nextval('public.apo214_evaluacionriesgo_id_seq'::regclass); + + +-- +-- Name: apo214_infoanomalia id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalia ALTER COLUMN id SET DEFAULT nextval('public.apo214_infoanomalia_id_seq'::regclass); + + +-- +-- Name: apo214_infoanomalialugar id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalialugar ALTER COLUMN id SET DEFAULT nextval('public.apo214_infoanomalialugar_id_seq'::regclass); + + +-- +-- Name: apo214_listaanexo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaanexo ALTER COLUMN id SET DEFAULT nextval('public.apo214_listaanexo_id_seq'::regclass); + + +-- +-- Name: apo214_listadepositados id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listadepositados ALTER COLUMN id SET DEFAULT nextval('public.apo214_listadepositados_id_seq'::regclass); + + +-- +-- Name: apo214_listaevariesgo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaevariesgo ALTER COLUMN id SET DEFAULT nextval('public.apo214_listaevariesgo_id_seq'::regclass); + + +-- +-- Name: apo214_listainfofoto id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listainfofoto ALTER COLUMN id SET DEFAULT nextval('public.apo214_listainfofoto_id_seq'::regclass); + + +-- +-- Name: apo214_listapersofuentes id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listapersofuentes ALTER COLUMN id SET DEFAULT nextval('public.apo214_listapersofuentes_id_seq'::regclass); + + +-- +-- Name: apo214_listasuelo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listasuelo ALTER COLUMN id SET DEFAULT nextval('public.apo214_listasuelo_id_seq'::regclass); + + +-- +-- Name: apo214_lugarpreliminar id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar ALTER COLUMN id SET DEFAULT nextval('public.apo214_lugarpreliminar_id_seq'::regclass); + + +-- +-- Name: apo214_propietario id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_propietario ALTER COLUMN id SET DEFAULT nextval('public.apo214_propietario_id_seq'::regclass); + + +-- +-- Name: apo214_riesgo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_riesgo ALTER COLUMN id SET DEFAULT nextval('public.apo214_riesgo_id_seq'::regclass); + + +-- +-- Name: apo214_suelo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_suelo ALTER COLUMN id SET DEFAULT nextval('public.apo214_suelo_id_seq'::regclass); + + +-- +-- Name: apo214_tipoentierro id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_tipoentierro ALTER COLUMN id SET DEFAULT nextval('public.apo214_tipoentierro_id_seq'::regclass); + + +-- +-- Name: apo214_tipotestigo id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_tipotestigo ALTER COLUMN id SET DEFAULT nextval('public.apo214_tipotestigo_id_seq'::regclass); + + -- -- Name: heb412_gen_campohc id; Type: DEFAULT; Schema: public; Owner: - -- @@ -4252,13 +5092,6 @@ ALTER TABLE ONLY public.sivel2_gen_actividadoficio ALTER COLUMN id SET DEFAULT n ALTER TABLE ONLY public.sivel2_gen_caso_solicitud ALTER COLUMN id SET DEFAULT nextval('public.sivel2_gen_caso_solicitud_id_seq'::regclass); --- --- Name: sivel2_gen_caso_ubicacionpre id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.sivel2_gen_caso_ubicacionpre ALTER COLUMN id SET DEFAULT nextval('public.sivel2_gen_caso_ubicacionpre_id_seq'::regclass); - - -- -- Name: sivel2_gen_combatiente id; Type: DEFAULT; Schema: public; Owner: - -- @@ -4317,6 +5150,158 @@ ALTER TABLE ONLY public.sivel2_gen_acto ADD CONSTRAINT acto_id_presponsable_id_categoria_id_persona_id_caso_key UNIQUE (presponsable_id, categoria_id, persona_id, caso_id); +-- +-- Name: apo214_asisreconocimiento apo214_asisreconocimiento_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_asisreconocimiento + ADD CONSTRAINT apo214_asisreconocimiento_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_cobertura apo214_cobertura_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_cobertura + ADD CONSTRAINT apo214_cobertura_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_disposicioncadaveres apo214_disposicioncadaveres_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_disposicioncadaveres + ADD CONSTRAINT apo214_disposicioncadaveres_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_elementopaisaje apo214_elementopaisaje_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_elementopaisaje + ADD CONSTRAINT apo214_elementopaisaje_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_evaluacionriesgo apo214_evaluacionriesgo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_evaluacionriesgo + ADD CONSTRAINT apo214_evaluacionriesgo_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_infoanomalia apo214_infoanomalia_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalia + ADD CONSTRAINT apo214_infoanomalia_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_infoanomalialugar apo214_infoanomalialugar_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalialugar + ADD CONSTRAINT apo214_infoanomalialugar_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_listaanexo apo214_listaanexo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaanexo + ADD CONSTRAINT apo214_listaanexo_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_listadepositados apo214_listadepositados_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listadepositados + ADD CONSTRAINT apo214_listadepositados_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_listaevariesgo apo214_listaevariesgo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaevariesgo + ADD CONSTRAINT apo214_listaevariesgo_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_listainfofoto apo214_listainfofoto_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listainfofoto + ADD CONSTRAINT apo214_listainfofoto_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_listapersofuentes apo214_listapersofuentes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listapersofuentes + ADD CONSTRAINT apo214_listapersofuentes_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_listasuelo apo214_listasuelo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listasuelo + ADD CONSTRAINT apo214_listasuelo_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_lugarpreliminar apo214_lugarpreliminar_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT apo214_lugarpreliminar_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_propietario apo214_propietario_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_propietario + ADD CONSTRAINT apo214_propietario_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_riesgo apo214_riesgo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_riesgo + ADD CONSTRAINT apo214_riesgo_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_suelo apo214_suelo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_suelo + ADD CONSTRAINT apo214_suelo_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_tipoentierro apo214_tipoentierro_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_tipoentierro + ADD CONSTRAINT apo214_tipoentierro_pkey PRIMARY KEY (id); + + +-- +-- Name: apo214_tipotestigo apo214_tipotestigo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_tipotestigo + ADD CONSTRAINT apo214_tipotestigo_pkey PRIMARY KEY (id); + + -- -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -5045,14 +6030,6 @@ ALTER TABLE ONLY public.sivel2_gen_caso_solicitud ADD CONSTRAINT sivel2_gen_caso_solicitud_pkey PRIMARY KEY (id); --- --- Name: sivel2_gen_caso_ubicacionpre sivel2_gen_caso_ubicacionpre_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.sivel2_gen_caso_ubicacionpre - ADD CONSTRAINT sivel2_gen_caso_ubicacionpre_pkey PRIMARY KEY (id); - - -- -- Name: sivel2_gen_combatiente sivel2_gen_combatiente_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -5373,13 +6350,6 @@ ALTER TABLE ONLY public.sivel2_gen_victima ADD CONSTRAINT victima_id_key UNIQUE (id); --- --- Name: busca_sivel2_gen_conscaso; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX busca_sivel2_gen_conscaso ON public.sivel2_gen_conscaso USING gin (q); - - -- -- Name: caso_fecha_idx; Type: INDEX; Schema: public; Owner: - -- @@ -6283,6 +7253,14 @@ ALTER TABLE ONLY public.sivel2_gen_filiacion_victimacolectiva ADD CONSTRAINT filiacion_victimacolectiva_victimacolectiva_id_fkey FOREIGN KEY (victimacolectiva_id) REFERENCES public.sivel2_gen_victimacolectiva(id); +-- +-- Name: apo214_propietario fk_rails_0425bff6ee; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_propietario + ADD CONSTRAINT fk_rails_0425bff6ee FOREIGN KEY (id_persona) REFERENCES public.msip_persona(id); + + -- -- Name: msip_etiqueta_persona fk_rails_05a9a878fd; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6291,6 +7269,14 @@ ALTER TABLE ONLY public.msip_etiqueta_persona ADD CONSTRAINT fk_rails_05a9a878fd FOREIGN KEY (etiqueta_id) REFERENCES public.msip_etiqueta(id); +-- +-- Name: apo214_propietario fk_rails_0629f9fb2c; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_propietario + ADD CONSTRAINT fk_rails_0629f9fb2c FOREIGN KEY (id_lugarpreliminar) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: sivel2_gen_caso_solicitud fk_rails_06deb84185; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6307,6 +7293,14 @@ ALTER TABLE ONLY public.msip_municipio ADD CONSTRAINT fk_rails_089870a38d FOREIGN KEY (departamento_id) REFERENCES public.msip_departamento(id); +-- +-- Name: apo214_listadepositados fk_rails_094cd32464; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listadepositados + ADD CONSTRAINT fk_rails_094cd32464 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: sivel2_gen_sectorsocialsec_victima fk_rails_0feb0e70eb; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6339,6 +7333,14 @@ ALTER TABLE ONLY public.mr519_gen_encuestapersona ADD CONSTRAINT fk_rails_13f8d66312 FOREIGN KEY (planencuesta_id) REFERENCES public.mr519_gen_planencuesta(id); +-- +-- Name: apo214_listaanexo fk_rails_15d910fc26; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaanexo + ADD CONSTRAINT fk_rails_15d910fc26 FOREIGN KEY (anexo_id) REFERENCES public.msip_anexo(id); + + -- -- Name: msip_etiqueta_persona fk_rails_1856abc5d3; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6372,11 +7374,11 @@ ALTER TABLE ONLY public.heb412_gen_campohc -- --- Name: sivel2_gen_caso_ubicacionpre fk_rails_1f53ddb66f; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: apo214_listadepositados fk_rails_2449cb19a2; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sivel2_gen_caso_ubicacionpre - ADD CONSTRAINT fk_rails_1f53ddb66f FOREIGN KEY (caso_id) REFERENCES public.sivel2_gen_caso(id); +ALTER TABLE ONLY public.apo214_listadepositados + ADD CONSTRAINT fk_rails_2449cb19a2 FOREIGN KEY (persona_id) REFERENCES public.msip_persona(id); -- @@ -6419,6 +7421,14 @@ ALTER TABLE ONLY public.sivel2_gen_otraorga_victima ADD CONSTRAINT fk_rails_3029d2736a FOREIGN KEY (organizacion_id) REFERENCES public.sivel2_gen_organizacion(id); +-- +-- Name: apo214_infoanomalialugar fk_rails_3aa92f63a0; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalialugar + ADD CONSTRAINT fk_rails_3aa92f63a0 FOREIGN KEY (infoanomalia_id) REFERENCES public.apo214_infoanomalia(id); + + -- -- Name: msip_ubicacionpre fk_rails_3b59c12090; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6427,6 +7437,22 @@ ALTER TABLE ONLY public.msip_ubicacionpre ADD CONSTRAINT fk_rails_3b59c12090 FOREIGN KEY (clase_id) REFERENCES public.msip_clase(id); +-- +-- Name: apo214_listaevariesgo fk_rails_3ee6e4c376; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaevariesgo + ADD CONSTRAINT fk_rails_3ee6e4c376 FOREIGN KEY (evaluacionriesgo_id) REFERENCES public.apo214_evaluacionriesgo(id); + + +-- +-- Name: apo214_lugarpreliminar fk_rails_42ec3f4e71; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_42ec3f4e71 FOREIGN KEY (elementopaisaje_id) REFERENCES public.apo214_elementopaisaje(id); + + -- -- Name: sivel2_gen_caso_solicitud fk_rails_435e539f61; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6435,6 +7461,14 @@ ALTER TABLE ONLY public.sivel2_gen_caso_solicitud ADD CONSTRAINT fk_rails_435e539f61 FOREIGN KEY (solicitud_id) REFERENCES public.msip_solicitud(id); +-- +-- Name: apo214_listapersofuentes fk_rails_44b1ed6894; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listapersofuentes + ADD CONSTRAINT fk_rails_44b1ed6894 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: msip_orgsocial_persona fk_rails_4672f6cbcd; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6483,6 +7517,14 @@ ALTER TABLE ONLY public.msip_orgsocial ADD CONSTRAINT fk_rails_5b21e3a2af FOREIGN KEY (grupoper_id) REFERENCES public.msip_grupoper(id); +-- +-- Name: apo214_lugarpreliminar fk_rails_5dc41e5b2c; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_5dc41e5b2c FOREIGN KEY (id_persona) REFERENCES public.msip_persona(id); + + -- -- Name: msip_solicitud_usuarionotificar fk_rails_6296c40917; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6539,6 +7581,22 @@ ALTER TABLE ONLY public.msip_grupo_usuario ADD CONSTRAINT fk_rails_734ee21e62 FOREIGN KEY (usuario_id) REFERENCES public.usuario(id); +-- +-- Name: apo214_infoanomalia fk_rails_78511df01b; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalia + ADD CONSTRAINT fk_rails_78511df01b FOREIGN KEY (anexo_id) REFERENCES public.msip_anexo(id); + + +-- +-- Name: apo214_listainfofoto fk_rails_7a80310d89; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listainfofoto + ADD CONSTRAINT fk_rails_7a80310d89 FOREIGN KEY (anexo_id) REFERENCES public.msip_anexo(id); + + -- -- Name: msip_orgsocial fk_rails_7bc2a60574; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6563,6 +7621,14 @@ ALTER TABLE ONLY public.mr519_gen_respuestafor ADD CONSTRAINT fk_rails_805efe6935 FOREIGN KEY (formulario_id) REFERENCES public.mr519_gen_formulario(id); +-- +-- Name: apo214_evaluacionriesgo fk_rails_81404f916d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_evaluacionriesgo + ADD CONSTRAINT fk_rails_81404f916d FOREIGN KEY (riesgo_id) REFERENCES public.apo214_riesgo(id); + + -- -- Name: mr519_gen_valorcampo fk_rails_819cf17399; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6571,6 +7637,14 @@ ALTER TABLE ONLY public.mr519_gen_valorcampo ADD CONSTRAINT fk_rails_819cf17399 FOREIGN KEY (campo_id) REFERENCES public.mr519_gen_campo(id); +-- +-- Name: apo214_listasuelo fk_rails_824ea49a05; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listasuelo + ADD CONSTRAINT fk_rails_824ea49a05 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: mr519_gen_encuestapersona fk_rails_83755e20b9; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6587,6 +7661,30 @@ ALTER TABLE ONLY public.sivel2_gen_caso ADD CONSTRAINT fk_rails_850036942a FOREIGN KEY (ubicacion_id) REFERENCES public.msip_ubicacion(id); +-- +-- Name: apo214_asisreconocimiento fk_rails_883533cb81; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_asisreconocimiento + ADD CONSTRAINT fk_rails_883533cb81 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + +-- +-- Name: apo214_infoanomalialugar fk_rails_8bb02cf8f4; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_infoanomalialugar + ADD CONSTRAINT fk_rails_8bb02cf8f4 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + +-- +-- Name: apo214_listaanexo fk_rails_8bb22a4c10; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaanexo + ADD CONSTRAINT fk_rails_8bb22a4c10 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: mr519_gen_valorcampo fk_rails_8bb7650018; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6612,19 +7710,19 @@ ALTER TABLE ONLY public.msip_departamento -- --- Name: sivel2_gen_combatiente fk_rails_95f4a0b8f6; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: apo214_lugarpreliminar fk_rails_9408f90341; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sivel2_gen_combatiente - ADD CONSTRAINT fk_rails_95f4a0b8f6 FOREIGN KEY (profesion_id) REFERENCES public.sivel2_gen_profesion(id); +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_9408f90341 FOREIGN KEY (archivokml_id) REFERENCES public.msip_anexo(id); -- --- Name: sivel2_gen_caso_ubicacionpre fk_rails_983730b4f0; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: sivel2_gen_combatiente fk_rails_95f4a0b8f6; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sivel2_gen_caso_ubicacionpre - ADD CONSTRAINT fk_rails_983730b4f0 FOREIGN KEY (ubicacionpre_id) REFERENCES public.msip_ubicacionpre(id); +ALTER TABLE ONLY public.sivel2_gen_combatiente + ADD CONSTRAINT fk_rails_95f4a0b8f6 FOREIGN KEY (profesion_id) REFERENCES public.sivel2_gen_profesion(id); -- @@ -6651,6 +7749,14 @@ ALTER TABLE ONLY public.msip_ubicacion ADD CONSTRAINT fk_rails_a1d509c79a FOREIGN KEY (clase_id) REFERENCES public.msip_clase(id); +-- +-- Name: apo214_listasuelo fk_rails_a510cd86fa; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listasuelo + ADD CONSTRAINT fk_rails_a510cd86fa FOREIGN KEY (suelo_id) REFERENCES public.apo214_suelo(id); + + -- -- Name: msip_solicitud fk_rails_a670d661ef; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6659,6 +7765,14 @@ ALTER TABLE ONLY public.msip_solicitud ADD CONSTRAINT fk_rails_a670d661ef FOREIGN KEY (usuario_id) REFERENCES public.usuario(id); +-- +-- Name: apo214_listapersofuentes fk_rails_abe0965e8d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listapersofuentes + ADD CONSTRAINT fk_rails_abe0965e8d FOREIGN KEY (persona_id) REFERENCES public.msip_persona(id); + + -- -- Name: sivel2_gen_combatiente fk_rails_af43e915a6; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6667,6 +7781,14 @@ ALTER TABLE ONLY public.sivel2_gen_combatiente ADD CONSTRAINT fk_rails_af43e915a6 FOREIGN KEY (filiacion_id) REFERENCES public.sivel2_gen_filiacion(id); +-- +-- Name: apo214_lugarpreliminar fk_rails_b80776fd3b; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_b80776fd3b FOREIGN KEY (ubicacionpre_id) REFERENCES public.msip_ubicacionpre(id); + + -- -- Name: msip_ubicacion fk_rails_b82283d945; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6675,6 +7797,14 @@ ALTER TABLE ONLY public.msip_ubicacion ADD CONSTRAINT fk_rails_b82283d945 FOREIGN KEY (municipio_id) REFERENCES public.msip_municipio(id); +-- +-- Name: apo214_asisreconocimiento fk_rails_b9116c62bf; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_asisreconocimiento + ADD CONSTRAINT fk_rails_b9116c62bf FOREIGN KEY (persona_id) REFERENCES public.msip_persona(id); + + -- -- Name: msip_etiqueta_persona fk_rails_beb3a49837; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6715,6 +7845,22 @@ ALTER TABLE ONLY public.usuario ADD CONSTRAINT fk_rails_cc636858ad FOREIGN KEY (tema_id) REFERENCES public.msip_tema(id); +-- +-- Name: apo214_lugarpreliminar fk_rails_cd4febda02; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_cd4febda02 FOREIGN KEY (cobertura_id) REFERENCES public.apo214_cobertura(id); + + +-- +-- Name: apo214_lugarpreliminar fk_rails_d2074c8fa3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_d2074c8fa3 FOREIGN KEY (otrolubicacionpre_id) REFERENCES public.msip_ubicacionpre(id); + + -- -- Name: msip_solicitud_usuarionotificar fk_rails_db0f7c1dd6; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6739,6 +7885,14 @@ ALTER TABLE ONLY public.sivel2_gen_sectorsocialsec_victima ADD CONSTRAINT fk_rails_e04ef7c3e5 FOREIGN KEY (victima_id) REFERENCES public.sivel2_gen_victima(id); +-- +-- Name: apo214_listaevariesgo fk_rails_e07ebee0d2; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listaevariesgo + ADD CONSTRAINT fk_rails_e07ebee0d2 FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: heb412_gen_campoplantillahcm fk_rails_e0e38e0782; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6771,6 +7925,22 @@ ALTER TABLE ONLY public.msip_ubicacionpre ADD CONSTRAINT fk_rails_eba8cc9124 FOREIGN KEY (pais_id) REFERENCES public.msip_pais(id); +-- +-- Name: apo214_lugarpreliminar fk_rails_ee76bec01f; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_ee76bec01f FOREIGN KEY (disposicioncadaveres_id) REFERENCES public.apo214_disposicioncadaveres(id); + + +-- +-- Name: apo214_listainfofoto fk_rails_efa5c4526f; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_listainfofoto + ADD CONSTRAINT fk_rails_efa5c4526f FOREIGN KEY (lugarpreliminar_id) REFERENCES public.apo214_lugarpreliminar(id); + + -- -- Name: msip_orgsocial_sectororgsocial fk_rails_f032bb21a6; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6787,6 +7957,14 @@ ALTER TABLE ONLY public.sivel2_gen_combatiente ADD CONSTRAINT fk_rails_f0cf2a7bec FOREIGN KEY (resagresion_id) REFERENCES public.sivel2_gen_resagresion(id); +-- +-- Name: apo214_lugarpreliminar fk_rails_f52877c43f; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_f52877c43f FOREIGN KEY (tipoentierro_id) REFERENCES public.apo214_tipoentierro(id); + + -- -- Name: sivel2_gen_combatiente fk_rails_f77dda7a40; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -6819,6 +7997,14 @@ ALTER TABLE ONLY public.heb412_gen_formulario_plantillahcm ADD CONSTRAINT fk_rails_fc3149fc44 FOREIGN KEY (plantillahcm_id) REFERENCES public.heb412_gen_plantillahcm(id); +-- +-- Name: apo214_lugarpreliminar fk_rails_fd33b98714; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.apo214_lugarpreliminar + ADD CONSTRAINT fk_rails_fd33b98714 FOREIGN KEY (tipotestigo_id) REFERENCES public.apo214_tipotestigo(id); + + -- -- Name: msip_solicitud fk_rails_ffa31a0de6; Type: FK CONSTRAINT; Schema: public; Owner: - --