Files
safekat/ci4/app/Database/Migrations/2024-11-30-160000_TareasServicioTable.php
2024-12-08 19:01:43 +01:00

65 lines
1.7 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ServicioClienteTareas extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"autoincrement" => true
],
"servicio_cliente_id" => [
"type" => "INT",
"unsigned" => true,
"comment" => "Servicio cliente asociado"
],
"tarifa_acabado_id" => [
"type" => "INT",
"unsigned" => true,
"comment" => "Tarifa de acabado asociada a servicio"
],
"tarifa_manipulado_id" => [
"type" => "INT",
"unsigned" => true,
"comment" => "Tarifa de manipulado asociada a servicio"
]
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->addForeignKey('tarifa_acabado_id','lg_tarifa_acabado','id');
$this->forge->addForeignKey('tarifa_manipulado_id','lg_tarifa_manipulado','id');
$this->forge->createTable("servicio_cliente_tareas", true);
}
public function down()
{
$this->forge->dropTable("servicio_cliente_tareas");
}
}