mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'add/view_logistica_principal'
Main See merge request jjimenez/safekat!705
This commit is contained in:
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class UpdateDateFieldsOrdenTrabajoDates extends Migration
|
||||
{
|
||||
protected array $DATES = [
|
||||
"cosido_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"solapa_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"grapado_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"retractilado_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"retractilado5_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"prototipo_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"marcapaginas_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
];
|
||||
protected array $USERS = [
|
||||
"cosido_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
"solapa_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
"grapado_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
"retractilado_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
"retractilado5_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
"prototipo_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
"marcapaginas_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
"null" => true,
|
||||
],
|
||||
];
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addColumn("orden_trabajo_dates", $this->DATES);
|
||||
$this->forge->addColumn("orden_trabajo_users", $this->USERS);
|
||||
foreach ($this->USERS as $key => $value) {
|
||||
$this->forge->addForeignKey([$key],"users",["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn("orden_trabajo_dates", array_keys($this->DATES));
|
||||
$this->forge->dropColumn("orden_trabajo_users", array_keys($this->USERS));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class AddFkOrdenTrabajoChatDepartment extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"orden_trabajo_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"unsigned" => true,
|
||||
"null" => true
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addColumn("chats", $this->COLUMNS);
|
||||
$this->forge->addColumn("chat_department_users", $this->COLUMNS);
|
||||
$this->forge->addForeignKey('orden_trabajo_id', 'ordenes_trabajo', 'id');
|
||||
$this->forge->processIndexes('chats');
|
||||
$this->forge->addForeignKey('orden_trabajo_id', 'ordenes_trabajo', 'id');
|
||||
$this->forge->processIndexes('chat_department_users');
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn("chats", ["orden_trabajo_id"]);
|
||||
$this->forge->dropColumn("chat_department_users", ["orden_trabajo_id"]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user