Migraciones

This commit is contained in:
Juan Pablo Vial
2024-11-28 11:37:26 -03:00
parent dafabdbbdb
commit 57fc6fa46e
11 changed files with 214 additions and 872 deletions

View File

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateTipoAgente extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$this->table('tipo_agente')
->addColumn('descripcion', 'string', ['limit' => 100, 'null' => false])
->addColumn('icono', 'string', ['limit' => 50, 'null' => true])
->addColumn('color', 'string', ['limit' => 6, 'null' => true])
->addColumn('bgcolor', 'string', ['limit' => 6, 'null' => true])
->create();
}
}

View File

@ -7,93 +7,9 @@ class Incoviba17303572256733fad3df01b extends Phinx\Migration\AbstractMigration
public function change()
{
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb3';");
$this->execute("ALTER DATABASE COLLATE='utf8mb3_general_ci';");
$this->table('tipo_estado_cierre', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'identity' => true,
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('vigente', 'integer', [
'null' => false,
'default' => '0',
'limit' => 1,
'signed' => false,
'after' => 'descripcion',
])
->create();
$this->table('logins', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'identity' => true,
])
->addColumn('user_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('time', 'datetime', [
'null' => false,
'after' => 'user_id',
])
->addColumn('selector', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'time',
])
->addColumn('token', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'selector',
])
->addColumn('status', 'integer', [
'null' => false,
'default' => '1',
'limit' => 1,
'after' => 'token',
])
->addIndex(['user_id'], [
'name' => 'fk_logins_users',
'unique' => false,
])
->addForeignKey('user_id', 'users', 'id', [
'constraint' => 'fk_logins_users',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->create();
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
$this->table('propiedad_unidad', [
'id' => false,
'primary_key' => ['id'],
@ -152,113 +68,7 @@ class Incoviba17303572256733fad3df01b extends Phinx\Migration\AbstractMigration
'delete' => 'CASCADE',
])
->create();
$this->table('agente', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'identity' => true,
])
->addColumn('tipo', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('rut', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'tipo',
])
->addColumn('descripcion', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'rut',
])
->addColumn('representante', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('telefono', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'representante',
])
->addColumn('correo', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'telefono',
])
->addColumn('direccion', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'correo',
])
->addColumn('giro', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_MEDIUM,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'direccion',
])
->addColumn('abreviacion', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'giro',
])
->addIndex(['tipo'], [
'name' => 'idx_tipo',
'unique' => false,
])
->create();
$this->table('tipo_estado_proyecto_agente', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'identity' => true,
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->create();
$this->table('unidad', [
'id' => false,
'primary_key' => ['id'],
@ -1449,7 +1259,7 @@ class Incoviba17303572256733fad3df01b extends Phinx\Migration\AbstractMigration
])
->addColumn('fecha_banco', 'date', [
'null' => false,
'default' => '0000-00-00',
'default' => 0,
'after' => 'fecha',
])
->addColumn('duracion', 'integer', [

View File

@ -0,0 +1,13 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
class CreateTipoEstadoCierre extends Phinx\Migration\AbstractMigration
{
public function change(): void
{
$this->table('tipo_estado_cierre')
->addColumn('descripcion', 'string', ['limit' => 50, 'null' => false])
->create();
}
}

View File

@ -0,0 +1,21 @@
<?php
use Phinx\Migration\AbstractMigration;
class CreateAgente extends AbstractMigration
{
public function change(): void
{
$this->table('agente')
->addColumn('tipo', 'integer', ['null' => true, 'default' => null])
->addColumn('rut', 'integer', ['null' => true, 'default' => null])
->addColumn('descripcion', 'string', ['null' => true, 'default' => null, 'limit' => 100])
->addColumn('representante', 'string', ['null' => true, 'default' => null, 'limit' => 100])
->addColumn('telefono', 'integer', ['null' => true, 'default' => null])
->addColumn('correo', 'string', ['null' => true, 'default' => null, 'limit' => 100])
->addColumn('direccion', 'string', ['null' => true, 'default' => null, 'limit' => 100])
->addColumn('giro', 'text', ['null' => true, 'default' => null])
->addColumn('abreviacion', 'text', ['null' => true, 'default' => null, 'limit' => 20])
->create();
}
}

View File

@ -0,0 +1,15 @@
<?php
use Phinx\Migration\AbstractMigration;
class CreateTipoEstadoProyectoAgente extends AbstractMigration
{
public function change(): void
{
$this->table('tipo_estado_proyecto_agente')
->addColumn('descripcion', 'string', ['limit' => 50, 'null' => false])
->addColumn('vigente', 'integer', ['null' => false, 'default' => 0, 'limit' => 1, 'signed' => false])
->create();
}
}

View File

@ -0,0 +1,19 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
class CreateLogins extends \Phinx\Migration\AbstractMigration
{
public function change(): void
{
$this->table('logins')
->addColumn('user_id', 'integer', ['null' => false, 'limit' => 10, 'signed' => false])
->addColumn('time', 'datetime', ['null' => false])
->addColumn('selector', 'string', ['null' => false, 'limit' => 255, 'collation' => 'utf8mb4_general_ci', 'encoding' => 'utf8mb4'])
->addColumn('token', 'string', ['null' => false, 'limit' => 255, 'collation' => 'utf8mb4_general_ci', 'encoding' => 'utf8mb4'])
->addColumn('status', 'integer', ['null' => false, 'default' => '1', 'limit' => 1])
->addIndex(['user_id'], ['name' => 'fk_logins_users', 'unique' => false])
->addForeignKey('user_id', 'users', 'id', ['constraint' => 'fk_logins_users', 'update' => 'CASCADE', 'delete' => 'CASCADE'])
->create();
}
}

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateTipoCobro extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$this->table('tipo_cobro')
->addColumn('descripcion', 'string', ['limit' => 100, 'null' => false])
->addColumn('monto_base', 'string', ['limit' => 100, 'null' => true])
->addColumn('modificador', 'string', ['limit' => 100, 'null' => true])
->addColumn('monto_neto', 'string', ['limit' => 100, 'null' => true])
->addColumn('operacion', 'integer', ['null' => true])
->addColumn('mod', 'float', ['null' => true])
->create();
}
}

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateTipoElemento extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$this->table('tipo_elemento')
->addColumn('descripcion', 'string', ['limit' => 50, 'null' => false])
->addColumn('abreviacion', 'string', ['limit' => 50, 'null' => false])
->addColumn('orden', 'integer', ['null' => false, 'unsigned' => true])
->create();
}
}

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateTipoEstadoCobro extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$this->table('tipo_estado_cobro')
->addColumn('descripcion', 'string', ['limit' => 20])
->create();
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateTipoEstadoPago extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$this->table('tipo_estado_pago')
->addColumn('descripcion', 'string', ['limit' => 20, 'null' => false])
->addColumn('active', 'integer', ['limit' => 1, 'default' => 0])
->create();
}
}

View File

@ -1,677 +0,0 @@
-- Adminer 4.8.1 MySQL 11.5.2-MariaDB-ubu2404 dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
USE `incoviba`;
SET NAMES utf8mb4;
DROP TABLE IF EXISTS `action`;
CREATE TABLE `action` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`description` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `agente`;
CREATE TABLE `agente` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`tipo` int(11) DEFAULT NULL,
`rut` int(11) DEFAULT NULL,
`descripcion` varchar(100) DEFAULT NULL,
`representante` varchar(100) DEFAULT NULL,
`telefono` int(11) DEFAULT NULL,
`correo` varchar(50) DEFAULT NULL,
`direccion` int(11) DEFAULT NULL,
`giro` mediumtext DEFAULT NULL,
`abreviacion` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_tipo` (`tipo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `agente_tipo`;
CREATE TABLE `agente_tipo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`agente` int(10) unsigned NOT NULL,
`tipo` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `agente` (`agente`),
KEY `tipo` (`tipo`),
CONSTRAINT `agente_tipo_ibfk_1` FOREIGN KEY (`agente`) REFERENCES `agente` (`id`) ON DELETE NO ACTION,
CONSTRAINT `agente_tipo_ibfk_2` FOREIGN KEY (`tipo`) REFERENCES `tipo_agente` (`id`) ON DELETE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `avance_construccion`;
CREATE TABLE `avance_construccion` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proyecto` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`numero` int(10) unsigned NOT NULL,
`avance` double unsigned NOT NULL,
`estado_pago` double unsigned NOT NULL,
`pagado` int(10) unsigned DEFAULT NULL,
`uf` double unsigned DEFAULT NULL,
`fecha_pagado` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `proyecto` (`proyecto`),
CONSTRAINT `avance_construccion_ibfk_1` FOREIGN KEY (`proyecto`) REFERENCES `proyecto` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `backup`;
CREATE TABLE `backup` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `banco`;
CREATE TABLE `banco` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `bono_pie`;
CREATE TABLE `bono_pie` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`valor` float DEFAULT NULL,
`pago` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `pago` (`pago`),
CONSTRAINT `bono_pie_ibfk_1` FOREIGN KEY (`pago`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `cartolas`;
CREATE TABLE `cartolas` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cuenta_id` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`cargos` bigint(20) unsigned NOT NULL DEFAULT 0,
`abonos` bigint(20) unsigned NOT NULL DEFAULT 0,
`saldo` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `cuenta_id` (`cuenta_id`),
CONSTRAINT `cartolas_ibfk_2` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `categorias_centros_costos`;
CREATE TABLE `categorias_centros_costos` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`descripcion` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `centros_costos`;
CREATE TABLE `centros_costos` (
`id` int(10) unsigned NOT NULL,
`tipo_centro_id` int(10) unsigned NOT NULL,
`categoria_id` int(10) unsigned NOT NULL,
`tipo_cuenta_id` int(10) unsigned DEFAULT NULL,
`cuenta_contable` varchar(100) NOT NULL,
`descripcion` mediumtext NOT NULL,
PRIMARY KEY (`id`),
KEY `tipo_centro_id` (`tipo_centro_id`),
KEY `categoria_id` (`categoria_id`),
KEY `tipo_cuenta_id` (`tipo_cuenta_id`),
CONSTRAINT `centros_costos_ibfk_3` FOREIGN KEY (`tipo_centro_id`) REFERENCES `tipos_centros_costos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `centros_costos_ibfk_4` FOREIGN KEY (`categoria_id`) REFERENCES `categorias_centros_costos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `cierre`;
CREATE TABLE `cierre` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proyecto` int(10) unsigned NOT NULL,
`precio` double NOT NULL,
`fecha` date NOT NULL,
`relacionado` int(1) DEFAULT 0,
`propietario` int(10) unsigned DEFAULT 0,
PRIMARY KEY (`id`),
KEY `proyecto` (`proyecto`),
CONSTRAINT `cierre_ibfk_2` FOREIGN KEY (`proyecto`) REFERENCES `proyecto` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `cobro`;
CREATE TABLE `cobro` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proyecto` int(11) DEFAULT NULL,
`agente` int(11) DEFAULT NULL,
`tipo` int(11) DEFAULT NULL,
`fecha` date DEFAULT NULL,
`valor` float DEFAULT NULL,
`iva` float DEFAULT 0,
`uf` float DEFAULT NULL,
`identificador` varchar(50) DEFAULT NULL,
`glosa` mediumtext DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `comentario`;
CREATE TABLE `comentario` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`venta` int(10) unsigned DEFAULT NULL,
`fecha` datetime DEFAULT NULL,
`texto` blob DEFAULT NULL,
`estado` int(11) DEFAULT 1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `comuna`;
CREATE TABLE `comuna` (
`id` int(11) unsigned NOT NULL,
`descripcion` varchar(50) NOT NULL,
`provincia` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_provincia` (`provincia`),
CONSTRAINT `comuna_ibfk_1` FOREIGN KEY (`provincia`) REFERENCES `provincia` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `configurations`;
CREATE TABLE `configurations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `costo`;
CREATE TABLE `costo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proyecto` int(11) DEFAULT NULL,
`tipo` int(11) DEFAULT NULL,
`valor` float DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `credito`;
CREATE TABLE `credito` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`banco` varchar(50) DEFAULT NULL,
`valor` float DEFAULT NULL,
`fecha` date DEFAULT NULL,
`uf` float DEFAULT NULL,
`abonado` int(1) DEFAULT 0,
`fecha_abono` date DEFAULT NULL,
`pago` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `cuenta`;
CREATE TABLE `cuenta` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`inmobiliaria` int(8) unsigned NOT NULL,
`banco` int(10) unsigned NOT NULL,
`cuenta` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `inmobiliaria` (`inmobiliaria`),
KEY `banco` (`banco`),
CONSTRAINT `cuenta_ibfk_1` FOREIGN KEY (`inmobiliaria`) REFERENCES `inmobiliaria` (`rut`) ON DELETE NO ACTION,
CONSTRAINT `cuenta_ibfk_2` FOREIGN KEY (`banco`) REFERENCES `banco` (`id`) ON DELETE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `cuota`;
CREATE TABLE `cuota` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pie` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`valor_$` int(10) unsigned NOT NULL,
`estado` tinyint(1) DEFAULT 0,
`banco` varchar(20) NOT NULL,
`fecha_pago` date DEFAULT NULL,
`abonado` tinyint(1) DEFAULT 0,
`fecha_abono` date DEFAULT NULL,
`uf` double DEFAULT 0,
`pago` int(10) unsigned DEFAULT NULL,
`numero` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_pago_cuota` (`pago`),
KEY `pie` (`pie`),
CONSTRAINT `cuota_ibfk_1` FOREIGN KEY (`pago`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `cuota_ibfk_2` FOREIGN KEY (`pie`) REFERENCES `pie` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `depositos`;
CREATE TABLE `depositos` (
`id` int(10) unsigned NOT NULL,
`cuenta_id` int(10) unsigned NOT NULL,
`capital` int(10) unsigned NOT NULL,
`futuro` int(10) unsigned NOT NULL,
`inicio` date NOT NULL,
`termino` date NOT NULL,
PRIMARY KEY (`id`),
KEY `cuenta_id` (`cuenta_id`),
CONSTRAINT `depositos_ibfk_2` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `direccion`;
CREATE TABLE `direccion` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`calle` varchar(255) NOT NULL,
`numero` int(10) unsigned NOT NULL,
`extra` varchar(255) NOT NULL,
`comuna` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_comuna` (`comuna`),
CONSTRAINT `direccion_ibfk_1` FOREIGN KEY (`comuna`) REFERENCES `comuna` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `entrega`;
CREATE TABLE `entrega` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fecha` date NOT NULL,
`fondo_operacion` int(11) DEFAULT 0,
`fondo_reserva` int(11) DEFAULT 0,
`fecha_fondo_operacion` date DEFAULT NULL,
`fecha_fondo_reserva` date DEFAULT NULL,
`pago_operacion` int(11) DEFAULT NULL,
`pago_reserva` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `escritura`;
CREATE TABLE `escritura` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`valor` bigint(20) NOT NULL,
`fecha` date NOT NULL,
`uf` float DEFAULT NULL,
`abonado` int(11) DEFAULT 0,
`fecha_abono` date DEFAULT NULL,
`pago` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estados_cuentas`;
CREATE TABLE `estados_cuentas` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cuenta_id` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `cuenta_id` (`cuenta_id`),
CONSTRAINT `estados_cuentas_ibfk_2` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_cierre`;
CREATE TABLE `estado_cierre` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cierre` int(10) unsigned NOT NULL,
`tipo` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
PRIMARY KEY (`id`),
KEY `cierre` (`cierre`),
KEY `tipo` (`tipo`),
CONSTRAINT `estado_cierre_ibfk_3` FOREIGN KEY (`cierre`) REFERENCES `cierre` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `estado_cierre_ibfk_4` FOREIGN KEY (`tipo`) REFERENCES `tipo_estado_cierre` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_cobro`;
CREATE TABLE `estado_cobro` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cobro` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`estado` int(11) NOT NULL,
PRIMARY KEY (`id`,`cobro`,`estado`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_pago`;
CREATE TABLE `estado_pago` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pago` int(11) unsigned NOT NULL,
`fecha` date NOT NULL,
`estado` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `estado` (`estado`),
CONSTRAINT `estado_pago_ibfk_1` FOREIGN KEY (`estado`) REFERENCES `tipo_estado_pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_precio`;
CREATE TABLE `estado_precio` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`precio` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`estado` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `precio` (`precio`),
KEY `estado` (`estado`),
CONSTRAINT `estado_precio_ibfk_3` FOREIGN KEY (`precio`) REFERENCES `precio` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `estado_precio_ibfk_4` FOREIGN KEY (`estado`) REFERENCES `tipo_estado_precio` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_problema`;
CREATE TABLE `estado_problema` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`problema` int(11) DEFAULT NULL,
`fecha` date DEFAULT NULL,
`estado` enum('ingreso','revision','correccion','ok') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_proyecto`;
CREATE TABLE `estado_proyecto` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proyecto` int(10) unsigned NOT NULL,
`estado` int(11) unsigned NOT NULL,
`fecha` date NOT NULL,
PRIMARY KEY (`id`),
KEY `proyecto` (`proyecto`),
KEY `estado` (`estado`),
CONSTRAINT `estado_proyecto_ibfk_1` FOREIGN KEY (`proyecto`) REFERENCES `proyecto` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `estado_proyecto_ibfk_3` FOREIGN KEY (`estado`) REFERENCES `tipo_estado_proyecto` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_proyecto_agente`;
CREATE TABLE `estado_proyecto_agente` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`agente` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`tipo` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_unidad_bloqueada`;
CREATE TABLE `estado_unidad_bloqueada` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`unidad` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`tipo` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `estado_venta`;
CREATE TABLE `estado_venta` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`venta` int(10) unsigned NOT NULL,
`estado` int(11) unsigned NOT NULL DEFAULT 1,
`fecha` date NOT NULL,
PRIMARY KEY (`id`),
KEY `escritura` (`venta`),
KEY `estado` (`estado`),
CONSTRAINT `estado_venta_ibfk_1` FOREIGN KEY (`estado`) REFERENCES `tipo_estado_venta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `estado_venta_ibfk_2` FOREIGN KEY (`venta`) REFERENCES `venta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `etapa_proyecto`;
CREATE TABLE `etapa_proyecto` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`descripcion` varchar(20) DEFAULT NULL,
`orden` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `facturas`;
CREATE TABLE `facturas` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`venta_id` int(10) unsigned NOT NULL,
`index` int(10) unsigned NOT NULL,
`proporcion` double unsigned NOT NULL,
`data` text NOT NULL,
PRIMARY KEY (`id`),
KEY `venta_id` (`venta_id`),
CONSTRAINT `facturas_ibfk_2` FOREIGN KEY (`venta_id`) REFERENCES `venta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `factura_proyecto_operador`;
CREATE TABLE `factura_proyecto_operador` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proyecto_id` int(10) unsigned NOT NULL,
`operador_id` int(10) unsigned NOT NULL,
`factura` int(10) unsigned NOT NULL,
`valor_uf` double unsigned NOT NULL,
`valor_neto` int(10) unsigned NOT NULL,
`iva` int(10) unsigned DEFAULT 0,
PRIMARY KEY (`id`),
KEY `proyecto_id` (`proyecto_id`),
KEY `operador_id` (`operador_id`),
CONSTRAINT `factura_proyecto_operador_ibfk_1` FOREIGN KEY (`proyecto_id`) REFERENCES `proyecto` (`id`) ON DELETE CASCADE,
CONSTRAINT `factura_proyecto_operador_ibfk_2` FOREIGN KEY (`operador_id`) REFERENCES `agente` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `factura_venta`;
CREATE TABLE `factura_venta` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`factura_id` int(10) unsigned NOT NULL,
`venta_id` int(10) unsigned NOT NULL,
`valor` double NOT NULL,
PRIMARY KEY (`id`),
KEY `factura_id` (`factura_id`),
KEY `venta_id` (`venta_id`),
CONSTRAINT `factura_venta_ibfk_1` FOREIGN KEY (`factura_id`) REFERENCES `factura_proyecto_operador` (`id`) ON DELETE CASCADE,
CONSTRAINT `factura_venta_ibfk_2` FOREIGN KEY (`venta_id`) REFERENCES `venta` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `inmobiliaria`;
CREATE TABLE `inmobiliaria` (
`rut` int(8) unsigned NOT NULL,
`dv` char(1) DEFAULT NULL,
`razon` varchar(255) DEFAULT NULL,
`abreviacion` varchar(50) DEFAULT NULL,
`cuenta` varchar(50) DEFAULT NULL,
`banco` int(11) DEFAULT NULL,
`sociedad` int(10) unsigned DEFAULT NULL,
`sigla` varchar(4) DEFAULT NULL,
PRIMARY KEY (`rut`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `inmobiliarias_nubox`;
CREATE TABLE `inmobiliarias_nubox` (
`inmobiliaria_rut` int(8) unsigned NOT NULL,
`alias` varchar(100) NOT NULL,
`usuario` varchar(100) NOT NULL,
`contraseña` varchar(100) NOT NULL,
KEY `inmobiliaria_rut` (`inmobiliaria_rut`),
CONSTRAINT `inmobiliarias_nubox_ibfk_2` FOREIGN KEY (`inmobiliaria_rut`) REFERENCES `inmobiliaria` (`rut`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `locations`;
CREATE TABLE `locations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`controller` varchar(50) NOT NULL,
`action` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `logins`;
CREATE TABLE `logins` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`time` datetime NOT NULL,
`selector` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`status` int(1) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `fk_logins_users` (`user_id`),
CONSTRAINT `fk_logins_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `monolog`;
CREATE TABLE `monolog` (
`channel` varchar(255) DEFAULT NULL,
`level` varchar(100) DEFAULT NULL,
`message` longtext DEFAULT NULL,
`time` datetime DEFAULT NULL,
`context` longtext DEFAULT NULL,
`extra` longtext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `movimientos`;
CREATE TABLE `movimientos` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cuenta_id` int(10) unsigned NOT NULL,
`fecha` date NOT NULL,
`glosa` text NOT NULL,
`documento` varchar(50) NOT NULL,
`cargo` bigint(20) unsigned NOT NULL DEFAULT 0,
`abono` bigint(20) unsigned NOT NULL DEFAULT 0,
`saldo` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `cuenta_id` (`cuenta_id`),
CONSTRAINT `movimientos_ibfk_2` FOREIGN KEY (`cuenta_id`) REFERENCES `cuenta` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `movimientos_detalles`;
CREATE TABLE `movimientos_detalles` (
`movimiento_id` int(10) unsigned NOT NULL,
`centro_costo_id` int(10) unsigned DEFAULT NULL,
`categoria` varchar(100) DEFAULT NULL,
`detalle` text DEFAULT NULL,
`rut` int(11) DEFAULT NULL,
`digito` varchar(1) DEFAULT NULL,
`nombres` varchar(255) DEFAULT NULL,
`identificador` varchar(100) DEFAULT NULL,
KEY `movimiento_id` (`movimiento_id`),
KEY `centro_costo_id` (`centro_costo_id`),
CONSTRAINT `movimientos_detalles_ibfk_3` FOREIGN KEY (`movimiento_id`) REFERENCES `movimientos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `movimientos_detalles_ibfk_5` FOREIGN KEY (`centro_costo_id`) REFERENCES `centros_costos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `pagare`;
CREATE TABLE `pagare` (
`id` int(10) unsigned NOT NULL,
`proyecto` int(10) unsigned NOT NULL,
`moneda` int(10) unsigned NOT NULL,
`capital` double unsigned NOT NULL DEFAULT 0,
`tasa` double unsigned NOT NULL DEFAULT 0,
`fecha` date NOT NULL,
`fecha_banco` date NOT NULL DEFAULT '0000-00-00',
`duracion` int(10) unsigned NOT NULL DEFAULT 0,
`uf` double unsigned NOT NULL DEFAULT 0,
`abonado` int(10) unsigned NOT NULL DEFAULT 0,
`estado_pago` int(10) unsigned NOT NULL DEFAULT 99999999,
PRIMARY KEY (`id`),
KEY `moneda` (`moneda`),
KEY `proyecto` (`proyecto`),
CONSTRAINT `pagare_ibfk_1` FOREIGN KEY (`moneda`) REFERENCES `tipo_moneda_pagare` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `pagare_ibfk_2` FOREIGN KEY (`proyecto`) REFERENCES `proyecto` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `pago`;
CREATE TABLE `pago` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`valor` double NOT NULL,
`banco` int(11) DEFAULT NULL,
`tipo` int(11) DEFAULT NULL,
`identificador` varchar(50) DEFAULT NULL,
`fecha` date DEFAULT NULL,
`uf` double DEFAULT NULL,
`pagador` varchar(50) DEFAULT NULL,
`asociado` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `pagos_centros_costos`;
CREATE TABLE `pagos_centros_costos` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pago_id` int(11) unsigned NOT NULL,
`centro_costo_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `pago_id` (`pago_id`),
KEY `centro_costo_id` (`centro_costo_id`),
CONSTRAINT `pagos_centros_costos_ibfk_3` FOREIGN KEY (`pago_id`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `pagos_centros_costos_ibfk_4` FOREIGN KEY (`centro_costo_id`) REFERENCES `centros_costos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` int(1) unsigned NOT NULL,
`ext_id` int(10) unsigned NOT NULL,
`action_id` int(10) unsigned NOT NULL,
`status` int(1) unsigned NOT NULL DEFAULT 1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `phinxlog`;
CREATE TABLE `phinxlog` (
`version` bigint(20) NOT NULL,
`migration_name` varchar(100) DEFAULT NULL,
`start_time` timestamp NULL DEFAULT NULL,
`end_time` timestamp NULL DEFAULT NULL,
`breakpoint` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `pie`;
CREATE TABLE `pie` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fecha` date NOT NULL,
`valor` double unsigned NOT NULL,
`uf` double unsigned DEFAULT NULL,
`cuotas` int(10) unsigned NOT NULL,
`asociado` int(11) DEFAULT 0,
`reajuste` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `precio`;
CREATE TABLE `precio` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`unidad` int(10) unsigned NOT NULL,
`valor` double NOT NULL,
PRIMARY KEY (`id`),
KEY `unidad` (`unidad`),
CONSTRAINT `precio_ibfk_2` FOREIGN KEY (`unidad`) REFERENCES `unidad` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `problema`;
CREATE TABLE `problema` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`venta` int(11) DEFAULT NULL,
`descripcion` mediumtext DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- 2024-11-12 15:11:54