Files
oficial/app/resources/database/migrations/20241113010315_incoviba_17303572256733fad_3df_01b.php

4729 lines
162 KiB
PHP
Raw Normal View History

2024-11-12 21:51:56 -03:00
<?php
use Phinx\Db\Adapter\MysqlAdapter;
2024-11-20 21:26:03 -03:00
class Incoviba17303572256733fad3df01b extends Phinx\Migration\AbstractMigration
2024-11-12 21:51:56 -03:00
{
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->table('propiedad_unidad', [
'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('propiedad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('unidad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'propiedad',
])
->addColumn('principal', 'integer', [
'null' => false,
'default' => '0',
'limit' => 1,
'signed' => false,
'after' => 'unidad',
])
->addColumn('valor', 'double', [
'null' => false,
'default' => '0',
'after' => 'principal',
])
->addIndex(['unidad'], [
'name' => 'unidad',
'unique' => false,
])
->addIndex(['propiedad'], [
'name' => 'propiedad',
'unique' => false,
])
->addForeignKey('unidad', 'unidad', 'id', [
'constraint' => 'propiedad_unidad_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('propiedad', 'propiedad', 'id', [
'constraint' => 'propiedad_unidad_ibfk_2',
'update' => 'CASCADE',
'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'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'identity' => true,
])
->addColumn('proyecto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('tipo', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'proyecto',
])
->addColumn('subtipo', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'tipo',
])
->addColumn('piso', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'subtipo',
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 30,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'piso',
])
->addColumn('abreviacion', 'string', [
'null' => false,
'limit' => 10,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('m2', 'float', [
'null' => true,
'default' => null,
'after' => 'abreviacion',
])
->addColumn('terraza', 'float', [
'null' => true,
'default' => null,
'after' => 'm2',
])
->addColumn('cubierta', 'float', [
'null' => true,
'default' => '0',
'after' => 'terraza',
])
->addColumn('logia', 'float', [
'null' => true,
'default' => null,
'after' => 'cubierta',
])
->addColumn('orientacion', 'char', [
'null' => true,
'default' => null,
'limit' => 2,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'logia',
])
->addColumn('costo_inmobiliaria', 'float', [
'null' => true,
'default' => '0',
'after' => 'orientacion',
])
->addColumn('pt', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'costo_inmobiliaria',
])
->addColumn('valor', 'float', [
'null' => true,
'default' => null,
'after' => 'pt',
])
->addIndex(['proyecto', 'descripcion', 'tipo'], [
'name' => 'idx_unidad',
'unique' => false,
])
->addIndex(['pt'], [
'name' => 'pt',
'unique' => false,
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'unidad_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('pt', 'proyecto_tipo_unidad', 'id', [
'constraint' => 'unidad_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('promocion', [
'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('proyecto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'proyecto',
])
->addColumn('titulo', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('fecha_inicio', 'date', [
'null' => false,
'after' => 'titulo',
])
->addIndex(['proyecto'], [
'name' => 'fk_proyecto_promocion',
'unique' => false,
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'fk_proyecto_promocion',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->create();
$this->table('propiedad', [
'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('unidad_principal', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('estacionamientos', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'unidad_principal',
])
->addColumn('bodegas', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'estacionamientos',
])
->addColumn('estado', 'integer', [
'null' => true,
'default' => '1',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'bodegas',
])
->addIndex(['unidad_principal'], [
'name' => 'fk_unidad_principal',
'unique' => false,
])
->addForeignKey('unidad_principal', 'unidad', 'id', [
'constraint' => 'fk_unidad_principal',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('tipo_sociedad', [
'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' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('abreviacion', 'string', [
'null' => false,
'limit' => 10,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->create();
$this->table('tipo_estado_pago', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
])
->addColumn('descripcion', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('active', 'integer', [
'null' => true,
'default' => '0',
'limit' => 1,
'after' => 'descripcion',
])
->create();
$this->table('backup', [
'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('date', 'datetime', [
'null' => true,
'default' => null,
'after' => 'id',
])
->create();
$this->table('categorias_centros_costos', [
'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('users', [
'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('name', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('password', 'string', [
'null' => true,
'default' => null,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'name',
])
->addColumn('enabled', 'integer', [
'null' => false,
'default' => '1',
'limit' => 1,
'after' => 'password',
])
->create();
$this->table('credito', [
'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('banco', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('valor', 'float', [
'null' => true,
'default' => null,
'after' => 'banco',
])
->addColumn('fecha', 'date', [
'null' => true,
'default' => null,
'after' => 'valor',
])
->addColumn('uf', 'float', [
'null' => true,
'default' => null,
'after' => 'fecha',
])
->addColumn('abonado', 'integer', [
'null' => true,
'default' => '0',
'limit' => 1,
'after' => 'uf',
])
->addColumn('fecha_abono', 'date', [
'null' => true,
'default' => null,
'after' => 'abonado',
])
->addColumn('pago', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fecha_abono',
])
->create();
$this->table('tipos_cuentas_costos', [
'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',
])
->create();
$this->table('remote_ip', [
'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('host', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('ip', 'string', [
'null' => false,
'limit' => 15,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'host',
])
->addColumn('updated', 'timestamp', [
'null' => false,
'default' => 'current_timestamp()',
'update' => 'CURRENT_TIMESTAMP',
'after' => 'ip',
])
->create();
$this->table('estado_precio', [
'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('precio', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'precio',
])
->addColumn('estado', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'fecha',
])
->addIndex(['precio'], [
'name' => 'precio',
'unique' => false,
])
->addIndex(['estado'], [
'name' => 'estado',
'unique' => false,
])
->addForeignKey('precio', 'precio', 'id', [
'constraint' => 'estado_precio_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('estado', 'tipo_estado_precio', 'id', [
'constraint' => 'estado_precio_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('tipo_estado_precio', [
'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',
])
->create();
$this->table('movimientos', [
'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('cuenta_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'cuenta_id',
])
->addColumn('glosa', 'text', [
'null' => false,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'fecha',
])
->addColumn('documento', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'glosa',
])
->addColumn('cargo', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'after' => 'documento',
])
->addColumn('abono', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'after' => 'cargo',
])
->addColumn('saldo', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'after' => 'abono',
])
->addIndex(['cuenta_id'], [
'name' => 'cuenta_id',
'unique' => false,
])
->addForeignKey('cuenta_id', 'cuenta', 'id', [
'constraint' => 'movimientos_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('user_roles', [
'id' => false,
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('user', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
])
->addColumn('role', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'user',
])
->addIndex(['user'], [
'name' => 'user',
'unique' => false,
])
->addIndex(['role'], [
'name' => 'role',
'unique' => false,
])
->addForeignKey('user', 'users', 'id', [
'constraint' => 'user_roles_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('role', 'roles', 'id', [
'constraint' => 'user_roles_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('precio', [
'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('unidad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'unidad',
])
->addIndex(['unidad'], [
'name' => 'unidad',
'unique' => false,
])
->addForeignKey('unidad', 'unidad', 'id', [
'constraint' => 'precio_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('bono_pie', [
'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('valor', 'float', [
'null' => true,
'default' => null,
'after' => 'id',
])
->addColumn('pago', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'valor',
])
->addIndex(['pago'], [
'name' => 'pago',
'unique' => false,
])
->addForeignKey('pago', 'pago', 'id', [
'constraint' => 'bono_pie_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('tipo_pago', [
'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' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->create();
$this->table('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('agente', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'agente',
])
->addColumn('tipo', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'fecha',
])
->create();
$this->table('unidad_bloqueada', [
'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('agente', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('unidad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'agente',
])
->create();
$this->table('provincia', [
'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,
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('region', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'descripcion',
])
->addIndex(['region'], [
'name' => 'fk_region',
'unique' => false,
])
->addForeignKey('region', 'region', 'id', [
'constraint' => 'fk_region',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->create();
$this->table('configurations', [
'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('name', 'string', [
'null' => false,
'limit' => 30,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('value', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'name',
])
->create();
$this->table('pagos_centros_costos', [
'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('pago_id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'id',
])
->addColumn('centro_costo_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'pago_id',
])
->addIndex(['pago_id'], [
'name' => 'pago_id',
'unique' => false,
])
->addIndex(['centro_costo_id'], [
'name' => 'centro_costo_id',
'unique' => false,
])
->addForeignKey('pago_id', 'pago', 'id', [
'constraint' => 'pagos_centros_costos_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('centro_costo_id', 'centros_costos', 'id', [
'constraint' => 'pagos_centros_costos_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('agente_tipo', [
'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('agente', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('tipo', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'agente',
])
->addIndex(['agente'], [
'name' => 'agente',
'unique' => false,
])
->addIndex(['tipo'], [
'name' => 'tipo',
'unique' => false,
])
->addForeignKey('agente', 'agente', 'id', [
'constraint' => 'agente_tipo_ibfk_1',
'update' => 'RESTRICT',
'delete' => 'NO_ACTION',
])
->addForeignKey('tipo', 'tipo_agente', 'id', [
'constraint' => 'agente_tipo_ibfk_2',
'update' => 'RESTRICT',
'delete' => 'NO_ACTION',
])
->create();
$this->table('relacion_inmobiliarias', [
'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('padre', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'id',
])
->addColumn('hijo', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'padre',
])
->create();
$this->table('factura_proyecto_operador', [
'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('proyecto_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('operador_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'proyecto_id',
])
->addColumn('factura', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'operador_id',
])
->addColumn('valor_uf', 'double', [
'null' => false,
'after' => 'factura',
])
->addColumn('valor_neto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'valor_uf',
])
->addColumn('iva', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'valor_neto',
])
->addIndex(['proyecto_id'], [
'name' => 'proyecto_id',
'unique' => false,
])
->addIndex(['operador_id'], [
'name' => 'operador_id',
'unique' => false,
])
->addForeignKey('proyecto_id', 'proyecto', 'id', [
'constraint' => 'factura_proyecto_operador_ibfk_1',
'update' => 'RESTRICT',
'delete' => 'CASCADE',
])
->addForeignKey('operador_id', 'agente', 'id', [
'constraint' => 'factura_proyecto_operador_ibfk_2',
'update' => 'RESTRICT',
'delete' => 'CASCADE',
])
->create();
$this->table('tipo_unidad', [
'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' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('orden', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'descripcion',
])
->create();
$this->table('factura_venta', [
'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('factura_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('venta_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'factura_id',
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'venta_id',
])
->addIndex(['factura_id'], [
'name' => 'factura_id',
'unique' => false,
])
->addIndex(['venta_id'], [
'name' => 'venta_id',
'unique' => false,
])
->addForeignKey('factura_id', 'factura_proyecto_operador', 'id', [
'constraint' => 'factura_venta_ibfk_1',
'update' => 'RESTRICT',
'delete' => 'CASCADE',
])
->addForeignKey('venta_id', 'venta', 'id', [
'constraint' => 'factura_venta_ibfk_2',
'update' => 'RESTRICT',
'delete' => 'CASCADE',
])
->create();
$this->table('pagare', [
'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,
])
->addColumn('proyecto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('moneda', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'proyecto',
])
->addColumn('capital', 'double', [
'null' => false,
'default' => '0',
'after' => 'moneda',
])
->addColumn('tasa', 'double', [
'null' => false,
'default' => '0',
'after' => 'capital',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'tasa',
])
->addColumn('fecha_banco', 'date', [
'null' => false,
'default' => '0000-00-00',
'after' => 'fecha',
])
->addColumn('duracion', 'integer', [
'null' => false,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'fecha_banco',
])
->addColumn('uf', 'double', [
'null' => false,
'default' => '0',
'after' => 'duracion',
])
->addColumn('abonado', 'integer', [
'null' => false,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'uf',
])
->addColumn('estado_pago', 'integer', [
'null' => false,
'default' => '99999999',
'limit' => 10,
'signed' => false,
'after' => 'abonado',
])
->addIndex(['moneda'], [
'name' => 'moneda',
'unique' => false,
])
->addIndex(['proyecto'], [
'name' => 'proyecto',
'unique' => false,
])
->addForeignKey('moneda', 'tipo_moneda_pagare', 'id', [
'constraint' => 'pagare_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'pagare_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('facturas', [
'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('venta_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('index', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'venta_id',
])
->addColumn('proporcion', 'double', [
'null' => false,
'after' => 'index',
])
->addColumn('data', 'text', [
'null' => false,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'proporcion',
])
->addIndex(['venta_id'], [
'name' => 'venta_id',
'unique' => false,
])
->addForeignKey('venta_id', 'venta', 'id', [
'constraint' => 'facturas_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('cuenta', [
'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('inmobiliaria', 'integer', [
'null' => false,
'limit' => 8,
'signed' => false,
'after' => 'id',
])
->addColumn('banco', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'inmobiliaria',
])
->addColumn('cuenta', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'banco',
])
->addIndex(['inmobiliaria'], [
'name' => 'inmobiliaria',
'unique' => false,
])
->addIndex(['banco'], [
'name' => 'banco',
'unique' => false,
])
->addForeignKey('inmobiliaria', 'inmobiliaria', 'rut', [
'constraint' => 'cuenta_ibfk_1',
'update' => 'RESTRICT',
'delete' => 'NO_ACTION',
])
->addForeignKey('banco', 'banco', 'id', [
'constraint' => 'cuenta_ibfk_2',
'update' => 'RESTRICT',
'delete' => 'NO_ACTION',
])
->create();
$this->table('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('proyecto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('precio', 'double', [
'null' => false,
'after' => 'proyecto',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'precio',
])
->addColumn('relacionado', 'integer', [
'null' => true,
'default' => '0',
'limit' => 1,
'after' => 'fecha',
])
->addColumn('propietario', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'relacionado',
])
->addIndex(['proyecto'], [
'name' => 'proyecto',
'unique' => false,
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'cierre_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('uf', [
'id' => false,
'primary_key' => ['fecha'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('fecha', 'date', [
'null' => false,
])
->addColumn('valor', 'float', [
'null' => true,
'default' => null,
'after' => 'fecha',
])
->create();
$this->table('tipo_cobro', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'identity' => true,
])
->addColumn('descripcion', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('monto_base', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('modificador', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'monto_base',
])
->addColumn('monto_neto', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'modificador',
])
->addColumn('operacion', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'monto_neto',
])
->addColumn('mod', 'float', [
'null' => true,
'default' => null,
'after' => 'operacion',
])
->create();
$this->table('tipo_valor_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',
])
->create();
$this->table('proyecto_terreno', [
'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('proyecto_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'proyecto_id',
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'fecha',
])
->addColumn('tipo_moneda_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'valor',
])
->addIndex(['proyecto_id'], [
'name' => 'proyecto_id',
'unique' => false,
])
->addIndex(['tipo_moneda_id'], [
'name' => 'tipo_moneda_id',
'unique' => false,
])
->addForeignKey('proyecto_id', 'proyecto', 'id', [
'constraint' => 'proyecto_terreno_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('tipo_moneda_id', 'tipo_moneda_pagare', 'id', [
'constraint' => 'proyecto_terreno_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('comuna', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('provincia', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'descripcion',
])
->addIndex(['provincia'], [
'name' => 'fk_provincia',
'unique' => false,
])
->addForeignKey('provincia', 'provincia', 'id', [
'constraint' => 'comuna_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('tipo_estado_venta', [
'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('activa', 'integer', [
'null' => false,
'limit' => 1,
'signed' => false,
'after' => 'descripcion',
])
->create();
$this->table('proyecto', [
'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('inmobiliaria', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('descripcion', 'text', [
'null' => false,
'limit' => MysqlAdapter::TEXT_MEDIUM,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'inmobiliaria',
])
->addColumn('direccion', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'descripcion',
])
->addColumn('superficie_terreno', 'float', [
'null' => false,
'default' => '0',
'after' => 'direccion',
])
->addColumn('valor_terreno', 'float', [
'null' => false,
'default' => '0',
'after' => 'superficie_terreno',
])
->addColumn('corredor', 'float', [
'null' => false,
'default' => '0',
'after' => 'valor_terreno',
])
->addColumn('superficie_sobre_nivel', 'float', [
'null' => false,
'default' => '0',
'after' => 'corredor',
])
->addColumn('superficie_bajo_nivel', 'float', [
'null' => false,
'default' => '0',
'after' => 'superficie_sobre_nivel',
])
->addColumn('pisos', 'integer', [
'null' => false,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'superficie_bajo_nivel',
])
->addColumn('subterraneos', 'integer', [
'null' => false,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'pisos',
])
->create();
$this->table('valor_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('cierre', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('tipo', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'cierre',
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'tipo',
])
->addIndex(['cierre'], [
'name' => 'cierre',
'unique' => false,
])
->addIndex(['tipo'], [
'name' => 'tipo',
'unique' => false,
])
->addForeignKey('cierre', 'cierre', 'id', [
'constraint' => 'valor_cierre_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('tipo', 'tipo_valor_cierre', 'id', [
'constraint' => 'valor_cierre_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('permissions', [
'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('type', 'integer', [
'null' => false,
'limit' => 1,
'signed' => false,
'after' => 'id',
])
->addColumn('ext_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'type',
])
->addColumn('action_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'ext_id',
])
->addColumn('status', 'integer', [
'null' => false,
'default' => '1',
'limit' => 1,
'signed' => false,
'after' => 'action_id',
])
->create();
$this->table('registries', [
'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', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('action', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'user',
])
->addColumn('time', 'datetime', [
'null' => false,
'default' => '0000-00-00 00:00:00',
'update' => 'CURRENT_TIMESTAMP',
'after' => 'action',
])
->addIndex(['user'], [
'name' => 'user',
'unique' => false,
])
->addForeignKey('user', 'users', 'id', [
'constraint' => 'registries_ibfk_1',
'update' => 'RESTRICT',
'delete' => 'NO_ACTION',
])
->create();
$this->table('cartolas', [
'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('cuenta_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'cuenta_id',
])
->addColumn('cargos', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'after' => 'fecha',
])
->addColumn('abonos', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'after' => 'cargos',
])
->addColumn('saldo', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'after' => 'abonos',
])
->addIndex(['cuenta_id'], [
'name' => 'cuenta_id',
'unique' => false,
])
->addForeignKey('cuenta_id', 'cuenta', 'id', [
'constraint' => 'cartolas_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('renovacion_pagare', [
'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('pagare', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('insoluto', 'double', [
'null' => false,
'after' => 'pagare',
])
->addColumn('intereses', 'double', [
'null' => false,
'after' => 'insoluto',
])
->addColumn('tasa', 'double', [
'null' => false,
'after' => 'intereses',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'tasa',
])
->addColumn('fecha_banco', 'date', [
'null' => false,
'after' => 'fecha',
])
->addColumn('uf', 'double', [
'null' => false,
'default' => '0',
'after' => 'fecha_banco',
])
->addColumn('duracion', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'uf',
])
->addIndex(['pagare'], [
'name' => 'pagare',
'unique' => false,
])
->addForeignKey('pagare', 'pagare', 'id', [
'constraint' => 'renovacion_pagare_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('avance_construccion', [
'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('proyecto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'proyecto',
])
->addColumn('numero', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'fecha',
])
->addColumn('avance', 'double', [
'null' => false,
'after' => 'numero',
])
->addColumn('estado_pago', 'double', [
'null' => false,
'after' => 'avance',
])
->addColumn('pagado', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'estado_pago',
])
->addColumn('uf', 'double', [
'null' => true,
'default' => null,
'after' => 'pagado',
])
->addColumn('fecha_pagado', 'date', [
'null' => true,
'default' => null,
'after' => 'uf',
])
->addIndex(['proyecto'], [
'name' => 'proyecto',
'unique' => false,
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'avance_construccion_ibfk_1',
'update' => 'RESTRICT',
'delete' => 'CASCADE',
])
->create();
$this->table('cobro', [
'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('proyecto', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('agente', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'proyecto',
])
->addColumn('tipo', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'agente',
])
->addColumn('fecha', 'date', [
'null' => true,
'default' => null,
'after' => 'tipo',
])
->addColumn('valor', 'float', [
'null' => true,
'default' => null,
'after' => 'fecha',
])
->addColumn('iva', 'float', [
'null' => true,
'default' => '0',
'after' => 'valor',
])
->addColumn('uf', 'float', [
'null' => true,
'default' => null,
'after' => 'iva',
])
->addColumn('identificador', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'uf',
])
->addColumn('glosa', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_MEDIUM,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'identificador',
])
->create();
$this->table('tipo_proyectista', [
'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' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->create();
$this->table('cuota', [
'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('pie', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'pie',
])
->addColumn('valor_$', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'fecha',
])
->addColumn('estado', 'boolean', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'valor_$',
])
->addColumn('banco', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'estado',
])
->addColumn('fecha_pago', 'date', [
'null' => true,
'default' => null,
'after' => 'banco',
])
->addColumn('abonado', 'boolean', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'fecha_pago',
])
->addColumn('fecha_abono', 'date', [
'null' => true,
'default' => null,
'after' => 'abonado',
])
->addColumn('uf', 'double', [
'null' => true,
'default' => '0',
'after' => 'fecha_abono',
])
->addColumn('pago', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'uf',
])
->addColumn('numero', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'pago',
])
->addIndex(['pago'], [
'name' => 'fk_pago_cuota',
'unique' => false,
])
->addIndex(['pie'], [
'name' => 'pie',
'unique' => false,
])
->addForeignKey('pago', 'pago', 'id', [
'constraint' => 'cuota_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('pie', 'pie', 'id', [
'constraint' => 'cuota_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('pago', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'identity' => true,
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'id',
])
->addColumn('banco', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'valor',
])
->addColumn('tipo', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'banco',
])
->addColumn('identificador', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'tipo',
])
->addColumn('fecha', 'date', [
'null' => true,
'default' => null,
'after' => 'identificador',
])
->addColumn('uf', 'double', [
'null' => true,
'default' => null,
'after' => 'fecha',
])
->addColumn('pagador', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'uf',
])
->addColumn('asociado', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'pagador',
])
->create();
$this->table('etapa_proyecto', [
'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' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('orden', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'descripcion',
])
->create();
$this->table('costo', [
'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('proyecto', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('tipo', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'proyecto',
])
->addColumn('valor', 'float', [
'null' => true,
'default' => null,
'after' => 'tipo',
])
->create();
$this->table('unidad_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('cierre', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('unidad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'cierre',
])
->addColumn('principal', 'integer', [
'null' => false,
'default' => '0',
'limit' => 1,
'after' => 'unidad',
])
->addIndex(['cierre'], [
'name' => 'cierre',
'unique' => false,
])
->addIndex(['unidad'], [
'name' => 'unidad',
'unique' => false,
])
->addForeignKey('cierre', 'cierre', 'id', [
'constraint' => 'unidad_cierre_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('unidad', 'unidad', 'id', [
'constraint' => 'unidad_cierre_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('inmobiliaria', [
'id' => false,
'primary_key' => ['rut'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('rut', 'integer', [
'null' => false,
'limit' => 8,
'signed' => false,
])
->addColumn('dv', 'char', [
'null' => true,
'default' => null,
'limit' => 1,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'rut',
])
->addColumn('razon', 'string', [
'null' => true,
'default' => null,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'dv',
])
->addColumn('abreviacion', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'razon',
])
->addColumn('cuenta', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'abreviacion',
])
->addColumn('banco', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'cuenta',
])
->addColumn('sociedad', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'banco',
])
->addColumn('sigla', 'string', [
'null' => true,
'default' => null,
'limit' => 4,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'sociedad',
])
->create();
$this->table('region', [
'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,
])
->addColumn('descripcion', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('numeral', 'char', [
'null' => false,
'limit' => 4,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('numeracion', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'numeral',
])
->addIndex(['numeracion'], [
'name' => 'idx_region',
'unique' => false,
])
->create();
$this->table('proyecto_tipo_unidad', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'identity' => true,
])
->addColumn('proyecto', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('tipo', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'proyecto',
])
->addColumn('nombre', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'tipo',
])
->addColumn('abreviacion', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'nombre',
])
->addColumn('m2', 'float', [
'null' => true,
'default' => null,
'after' => 'abreviacion',
])
->addColumn('logia', 'float', [
'null' => true,
'default' => '0',
'after' => 'm2',
])
->addColumn('terraza', 'float', [
'null' => true,
'default' => '0',
'after' => 'logia',
])
->addColumn('descripcion', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_MEDIUM,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'terraza',
])
->addIndex(['proyecto'], [
'name' => 'fk_proyecto_pt',
'unique' => false,
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'fk_proyecto_pt',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->create();
$this->table('relacion_agentes', [
'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('agente1', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('agente2', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'agente1',
])
->create();
$this->table('subsidio', [
'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('pago', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('subsidio', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'pago',
])
->create();
$this->table('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('proyecto', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('agente', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'proyecto',
])
->addColumn('fecha', 'date', [
'null' => true,
'default' => null,
'after' => 'agente',
])
->addColumn('comision', 'float', [
'null' => true,
'default' => '0',
'after' => 'fecha',
])
->create();
$this->table('tipo_elemento', [
'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('abreviacion', 'string', [
'null' => false,
'limit' => 10,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('orden', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'abreviacion',
])
->create();
$this->table('roles', [
'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('description', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('level', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'description',
])
->addColumn('inherits', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'level',
])
->create();
$this->table('propietario', [
'id' => false,
'primary_key' => ['rut'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('rut', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
])
->addColumn('dv', 'char', [
'null' => false,
'limit' => 1,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'rut',
])
->addColumn('nombres', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'dv',
])
->addColumn('apellido_paterno', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'nombres',
])
->addColumn('apellido_materno', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'apellido_paterno',
])
->addColumn('sexo', 'string', [
'null' => true,
'default' => null,
'limit' => 1,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'apellido_materno',
])
->addColumn('estado_civil', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'sexo',
])
->addColumn('profesion', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'estado_civil',
])
->addColumn('direccion', 'integer', [
'null' => false,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'profesion',
])
->addColumn('telefono', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'direccion',
])
->addColumn('email', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'telefono',
])
->addColumn('representante', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'after' => 'email',
])
->addColumn('otro', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'representante',
])
->create();
$this->table('estado_proyecto', [
'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('proyecto', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('estado', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'proyecto',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'estado',
])
->addIndex(['proyecto'], [
'name' => 'proyecto',
'unique' => false,
])
->addIndex(['estado'], [
'name' => 'estado',
'unique' => false,
])
->addForeignKey('proyecto', 'proyecto', 'id', [
'constraint' => 'estado_proyecto_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('estado', 'tipo_estado_proyecto', 'id', [
'constraint' => 'estado_proyecto_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('banco', [
'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('nombre', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->create();
$this->table('estado_venta', [
'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('venta', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('estado', 'integer', [
'null' => false,
'default' => '1',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'venta',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'estado',
])
->addIndex(['venta'], [
'name' => 'escritura',
'unique' => false,
])
->addIndex(['estado'], [
'name' => 'estado',
'unique' => false,
])
->addForeignKey('estado', 'tipo_estado_venta', 'id', [
'constraint' => 'estado_venta_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('venta', 'venta', 'id', [
'constraint' => 'estado_venta_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('estado_cobro', [
'id' => false,
'primary_key' => ['id', 'cobro', 'estado'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'identity' => true,
])
->addColumn('cobro', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'cobro',
])
->addColumn('estado', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fecha',
])
->create();
$this->table('estado_pago', [
'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('pago', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'pago',
])
->addColumn('estado', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fecha',
])
->addIndex(['estado'], [
'name' => 'estado',
'unique' => false,
])
->addForeignKey('estado', 'tipo_estado_pago', 'id', [
'constraint' => 'estado_pago_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('tipo_estado_unidad_bloqueada', [
'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',
])
->addColumn('activo', 'integer', [
'null' => false,
'limit' => 1,
'signed' => false,
'after' => 'descripcion',
])
->create();
$this->table('venta', [
'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('propietario', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('propiedad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'propietario',
])
->addColumn('pie', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'propiedad',
])
->addColumn('bono_pie', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'pie',
])
->addColumn('credito', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'bono_pie',
])
->addColumn('escritura', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'credito',
])
->addColumn('subsidio', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'escritura',
])
->addColumn('escriturado', 'date', [
'null' => true,
'default' => null,
'after' => 'subsidio',
])
->addColumn('entrega', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'escriturado',
])
->addColumn('entregado', 'date', [
'null' => true,
'default' => null,
'after' => 'entrega',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'entregado',
])
->addColumn('valor_uf', 'double', [
'null' => false,
'after' => 'fecha',
])
->addColumn('estado', 'integer', [
'null' => false,
'default' => '1',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'valor_uf',
])
->addColumn('fecha_ingreso', 'date', [
'null' => true,
'default' => null,
'after' => 'estado',
])
->addColumn('avalchile', 'boolean', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'fecha_ingreso',
])
->addColumn('agente', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'avalchile',
])
->addColumn('uf', 'double', [
'null' => true,
'default' => null,
'after' => 'agente',
])
->addColumn('relacionado', 'integer', [
'null' => true,
'default' => '0',
'limit' => 1,
'after' => 'uf',
])
->addColumn('promocion', 'integer', [
'null' => true,
'default' => '0',
'limit' => 10,
'signed' => false,
'after' => 'relacionado',
])
->addColumn('resciliacion', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'promocion',
])
->addColumn('devolucion', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'resciliacion',
])
->addIndex(['propietario'], [
'name' => 'idx_propietario',
'unique' => false,
])
->addIndex(['fecha'], [
'name' => 'idx_fecha',
'unique' => false,
])
->addIndex(['propiedad'], [
'name' => 'fk_propiedad_venta',
'unique' => false,
])
->addForeignKey('propiedad', 'propiedad', 'id', [
'constraint' => 'fk_propiedad_venta',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->addForeignKey('propietario', 'propietario', 'rut', [
'constraint' => 'venta_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('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('cierre', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('tipo', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'cierre',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'tipo',
])
->addIndex(['cierre'], [
'name' => 'cierre',
'unique' => false,
])
->addIndex(['tipo'], [
'name' => 'tipo',
'unique' => false,
])
->addForeignKey('cierre', 'cierre', 'id', [
'constraint' => 'estado_cierre_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('tipo', 'tipo_estado_cierre', 'id', [
'constraint' => 'estado_cierre_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('proyectista', [
'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('rut', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('nombre', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'rut',
])
->addColumn('tipo', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'nombre',
])
->addColumn('representante', 'string', [
'null' => true,
'default' => null,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'tipo',
])
->addColumn('telefono', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'representante',
])
->addColumn('correo', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'telefono',
])
->addColumn('direccion', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'correo',
])
->create();
$this->table('movimientos_detalles', [
'id' => false,
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('movimiento_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
])
->addColumn('centro_costo_id', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'movimiento_id',
])
->addColumn('categoria', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'centro_costo_id',
])
->addColumn('detalle', 'text', [
'null' => true,
'default' => null,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'categoria',
])
->addColumn('rut', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'detalle',
])
->addColumn('digito', 'string', [
'null' => true,
'default' => null,
'limit' => 1,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'rut',
])
->addColumn('nombres', 'string', [
'null' => true,
'default' => null,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'digito',
])
->addColumn('identificador', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'nombres',
])
->addIndex(['movimiento_id'], [
'name' => 'movimiento_id',
'unique' => false,
])
->addIndex(['centro_costo_id'], [
'name' => 'centro_costo_id',
'unique' => false,
])
->addForeignKey('movimiento_id', 'movimientos', 'id', [
'constraint' => 'movimientos_detalles_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('centro_costo_id', 'centros_costos', 'id', [
'constraint' => 'movimientos_detalles_ibfk_5',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('proyectistas', [
'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('proyecto', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('proyectista', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'proyecto',
])
->addColumn('fecha', 'date', [
'null' => true,
'default' => null,
'after' => 'proyectista',
])
->create();
$this->table('tipo_tipologia', [
'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' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('tipologia', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'tipo',
])
->addColumn('cantidad', 'integer', [
'null' => false,
'limit' => 10,
'after' => 'tipologia',
])
->addColumn('elemento', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'cantidad',
])
->addIndex(['elemento'], [
'name' => 'elemento',
'unique' => false,
])
->addIndex(['tipologia'], [
'name' => 'tipologia',
'unique' => false,
])
->addIndex(['tipo'], [
'name' => 'tipo',
'unique' => false,
])
->addForeignKey('elemento', 'tipo_elemento', 'id', [
'constraint' => 'tipo_tipologia_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('tipologia', 'tipologia', 'id', [
'constraint' => 'tipo_tipologia_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('tipo', 'proyecto_tipo_unidad', 'id', [
'constraint' => 'tipo_tipologia_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('depositos', [
'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,
])
->addColumn('cuenta_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('capital', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'cuenta_id',
])
->addColumn('futuro', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'capital',
])
->addColumn('inicio', 'date', [
'null' => false,
'after' => 'futuro',
])
->addColumn('termino', 'date', [
'null' => false,
'after' => 'inicio',
])
->addIndex(['cuenta_id'], [
'name' => 'cuenta_id',
'unique' => false,
])
->addForeignKey('cuenta_id', 'cuenta', 'id', [
'constraint' => 'depositos_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('unidad_prorrateo', [
'id' => false,
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('unidad_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
])
->addColumn('prorrateo', 'double', [
'null' => false,
'after' => 'unidad_id',
])
->addIndex(['unidad_id'], [
'name' => 'unidad_id',
'unique' => false,
])
->addForeignKey('unidad_id', 'unidad', 'id', [
'constraint' => 'unidad_prorrateo_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('escritura', [
'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('valor', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_BIG,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'valor',
])
->addColumn('uf', 'float', [
'null' => true,
'default' => null,
'after' => 'fecha',
])
->addColumn('abonado', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'uf',
])
->addColumn('fecha_abono', 'date', [
'null' => true,
'default' => null,
'after' => 'abonado',
])
->addColumn('pago', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fecha_abono',
])
->create();
$this->table('comentario', [
'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('venta', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'datetime', [
'null' => true,
'default' => null,
'after' => 'venta',
])
->addColumn('texto', 'blob', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::BLOB_REGULAR,
'after' => 'fecha',
])
->addColumn('estado', 'integer', [
'null' => true,
'default' => '1',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'texto',
])
->create();
$this->table('estados_cuentas', [
'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('cuenta_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'cuenta_id',
])
->addColumn('active', 'boolean', [
'null' => false,
'limit' => MysqlAdapter::INT_TINY,
'after' => 'fecha',
])
->addIndex(['cuenta_id'], [
'name' => 'cuenta_id',
'unique' => false,
])
->addForeignKey('cuenta_id', 'cuenta', 'id', [
'constraint' => 'estados_cuentas_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('registry_data', [
'id' => false,
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
])
->addColumn('registry', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('column', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'registry',
])
->addColumn('old', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'column',
])
->addColumn('new', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'old',
])
->addIndex(['registry'], [
'name' => 'registry',
'unique' => false,
])
->addForeignKey('registry', 'registries', 'id', [
'constraint' => 'registry_data_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('action', [
'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('description', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->create();
$this->table('centros_costos', [
'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,
])
->addColumn('tipo_centro_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('categoria_id', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'tipo_centro_id',
])
->addColumn('tipo_cuenta_id', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'categoria_id',
])
->addColumn('cuenta_contable', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'tipo_cuenta_id',
])
->addColumn('descripcion', 'text', [
'null' => false,
'limit' => MysqlAdapter::TEXT_MEDIUM,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'cuenta_contable',
])
->addIndex(['tipo_centro_id'], [
'name' => 'tipo_centro_id',
'unique' => false,
])
->addIndex(['categoria_id'], [
'name' => 'categoria_id',
'unique' => false,
])
->addIndex(['tipo_cuenta_id'], [
'name' => 'tipo_cuenta_id',
'unique' => false,
])
->addForeignKey('tipo_centro_id', 'tipos_centros_costos', 'id', [
'constraint' => 'centros_costos_ibfk_3',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->addForeignKey('categoria_id', 'categorias_centros_costos', 'id', [
'constraint' => 'centros_costos_ibfk_4',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('estado_unidad_bloqueada', [
'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('unidad', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => false,
'after' => 'unidad',
])
->addColumn('tipo', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'fecha',
])
->create();
$this->table('entrega', [
'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('fecha', 'date', [
'null' => false,
'after' => 'id',
])
->addColumn('fondo_operacion', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fecha',
])
->addColumn('fondo_reserva', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fondo_operacion',
])
->addColumn('fecha_fondo_operacion', 'date', [
'null' => true,
'default' => null,
'after' => 'fondo_reserva',
])
->addColumn('fecha_fondo_reserva', 'date', [
'null' => true,
'default' => null,
'after' => 'fecha_fondo_operacion',
])
->addColumn('pago_operacion', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'fecha_fondo_reserva',
])
->addColumn('pago_reserva', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'pago_operacion',
])
->create();
$this->table('promocion_venta', [
'id' => false,
'primary_key' => ['promocion', 'venta'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('promocion', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
])
->addColumn('venta', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'promocion',
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'venta',
])
->addForeignKey('promocion', 'promocion', 'id', [
'constraint' => 'fk_promocion_venta',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->create();
$this->table('monolog', [
'id' => false,
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('channel', 'string', [
'null' => true,
'default' => null,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
])
->addColumn('level', 'string', [
'null' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'channel',
])
->addColumn('message', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_LONG,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'level',
])
->addColumn('time', 'datetime', [
'null' => true,
'default' => null,
'after' => 'message',
])
->addColumn('context', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_LONG,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'time',
])
->addColumn('extra', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_LONG,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'context',
])
->create();
$this->table('inmobiliarias_nubox', [
'id' => false,
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('inmobiliaria_rut', 'integer', [
'null' => false,
'limit' => 8,
'signed' => false,
])
->addColumn('alias', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'inmobiliaria_rut',
])
->addColumn('usuario', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'alias',
])
->addColumn('contraseña', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'usuario',
])
->addIndex(['inmobiliaria_rut'], [
'name' => 'inmobiliaria_rut',
'unique' => false,
])
->addForeignKey('inmobiliaria_rut', 'inmobiliaria', 'rut', [
'constraint' => 'inmobiliarias_nubox_ibfk_2',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('locations', [
'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('controller', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('action', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'controller',
])
->create();
$this->table('direccion', [
'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('calle', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('numero', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'calle',
])
->addColumn('extra', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'numero',
])
->addColumn('comuna', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'extra',
])
->addIndex(['comuna'], [
'name' => 'fk_comuna',
'unique' => false,
])
->addForeignKey('comuna', 'comuna', 'id', [
'constraint' => 'direccion_ibfk_1',
'update' => 'CASCADE',
'delete' => 'CASCADE',
])
->create();
$this->table('tipos_centros_costos', [
'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',
])
->create();
$this->table('tipo_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' => true,
'default' => null,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('icono', 'string', [
'null' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'descripcion',
])
->addColumn('color', 'string', [
'null' => true,
'default' => null,
'limit' => 6,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'icono',
])
->addColumn('bgcolor', 'string', [
'null' => true,
'default' => null,
'limit' => 6,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'color',
])
->create();
$this->table('tipo_estado_proyecto', [
'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' => true,
'default' => null,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('orden', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'descripcion',
])
->addColumn('etapa', 'integer', [
'null' => true,
'default' => null,
'limit' => 10,
'signed' => false,
'after' => 'orden',
])
->addIndex(['etapa'], [
'name' => 'fk_etapa',
'unique' => false,
])
->addIndex(['orden'], [
'name' => 'idx_orden',
'unique' => false,
])
->addIndex(['descripcion'], [
'name' => 'idx_descripcion',
'unique' => false,
])
->addForeignKey('etapa', 'etapa_proyecto', 'id', [
'constraint' => 'fk_etapa',
'update' => 'RESTRICT',
'delete' => 'RESTRICT',
])
->create();
$this->table('estado_problema', [
'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('problema', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('fecha', 'date', [
'null' => true,
'default' => null,
'after' => 'problema',
])
->addColumn('estado', 'enum', [
'null' => true,
'default' => null,
'limit' => 10,
'values' => ['ingreso', 'revision', 'correccion', 'ok'],
'after' => 'fecha',
])
->create();
$this->table('problema', [
'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('venta', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('descripcion', 'text', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::TEXT_MEDIUM,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'venta',
])
->create();
$this->table('tipo_estado_cobro', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
])
->addColumn('descripcion', 'string', [
'null' => true,
'default' => null,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->create();
$this->table('pie', [
'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('fecha', 'date', [
'null' => false,
'after' => 'id',
])
->addColumn('valor', 'double', [
'null' => false,
'after' => 'fecha',
])
->addColumn('uf', 'double', [
'null' => true,
'default' => null,
'after' => 'valor',
])
->addColumn('cuotas', 'integer', [
'null' => false,
'limit' => 10,
'signed' => false,
'after' => 'uf',
])
->addColumn('asociado', 'integer', [
'null' => true,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'cuotas',
])
->addColumn('reajuste', 'integer', [
'null' => true,
'default' => null,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'after' => 'asociado',
])
->create();
$this->table('tipo_moneda_pagare', [
'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',
])
->create();
$this->table('tipologia', [
'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',
])
->create();
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
}
}