mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
114 lines
3.4 KiB
PHP
Executable File
114 lines
3.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
use function PHPSTORM_META\type;
|
|
|
|
class CreateServiciosAcabadoTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'nombre' =>[
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
],
|
|
'comentarios' => [
|
|
'type' => 'TEXT',
|
|
'null' => true,
|
|
],
|
|
'acabado_cubierta' => [
|
|
'type' => 'BOOLEAN',
|
|
'default' => false,
|
|
],
|
|
'acabado_sobrecubierta' => [
|
|
'type' => 'BOOLEAN',
|
|
'default' => false,
|
|
],
|
|
'mostrar_en_presupuesto_cliente' => [
|
|
'type' => 'BOOLEAN',
|
|
'default' => true,
|
|
],
|
|
'user_updated_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'deleted_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addPrimaryKey('id');
|
|
$this->forge->addForeignKey('user_updated_id', 'users', 'id', 'CASCADE', 'CASCADE');
|
|
|
|
$this->forge->createTable('servicios_acabado');
|
|
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'tarifa_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
],
|
|
'servicio_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
],
|
|
'user_updated_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'deleted_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addPrimaryKey('id');
|
|
$this->forge->addForeignKey('servicio_id', 'servicios_acabado', 'id', 'NO_ACTION', 'NO_ACTION');
|
|
$this->forge->addForeignKey('tarifa_id', 'lg_tarifa_acabado', 'id', 'NO_ACTION', 'NO_ACTION');
|
|
$this->forge->addForeignKey('user_updated_id', 'users', 'id', 'NO_ACTION', 'NO_ACTION');
|
|
|
|
$this->forge->createTable('tarifasAcabado_serviciosAcabado');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('servicios_acabado');
|
|
$this->forge->dropTable('tarifasAcabado_serviciosAcabado');
|
|
}
|
|
}
|