/* 
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Other/SQLTemplate.sql to edit this template
 */
/**
 * Author:  Cato32
 * Created: 19 may 2023
 */


Cambios base de datos:
CREATE TABLE urbanizacion (
 id Char(36) not null primary key,
 id_proyecto Char(36) not null,
 nombre TEXT not null,
 costo Double not null,
 costo_por_lote Double not null,
 created_by Char (36) not null,
 created_on datetime not null,
 last_updated_by Char (36) default null,
 last_updated_on datetime default null
);

ALTER TABLE `crov_inmobiliaria`.`urbanizacion` 
ADD COLUMN `estatus_activo` ENUM('ENABLED', 'DISABLED') NULL DEFAULT 'ENABLED' AFTER `last_updated_on`;

CREATE TABLE detalle_lote_urbanizacion(
id char(36) not null primary key,
id_lote char(36) not null,
id_urbanizacion char(36) not null,
saldo_anterior Double not null,
saldo_pagado Double not null,
saldo_nuevo Double not null,
created_by char(36) not null,
created_on datetime not null,
last_updated_by char(36),
last_updated_on datetime
);


CREATE TABLE detalle_lote_etapa_juridica (
	id char(36) primary key not null,
    id_lote char(36) not null,
    id_etapa_juridica char(36) not null,
    descripcion text default null,
    deuda_total Double default 0.0,
	created_by Char (36) not null,
	created_on datetime not null,
	last_updated_by Char (36) default null,
	last_updated_on datetime default null
);

CREATE TABLE `propietario_predio` (
  `id` char(36) NOT NULL,
  `id_predio` char(36) NOT NULL,
  `id_propietario_nuevo` char(36) NOT NULL,
  `id_propietario_viejo` char(36) NOT NULL,
  `comentario` text NOT NULL,
  `created_by` char(36) NOT NULL,
  `created_on` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


ALTER TABLE crov_inmobiliaria.abono_lote ADD pago_juridico int DEFAULT 0;
