From 00ff185cf165ded9eb3eb52c30ac2ea6332d72c9 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Fri, 4 Apr 2025 00:51:55 +0200 Subject: [PATCH] orden_trabajo_files_table migrate --- ...25-04-03-233800_OrdenTrabajoFilesTable.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 ci4/app/Database/Migrations/2025-04-03-233800_OrdenTrabajoFilesTable.php diff --git a/ci4/app/Database/Migrations/2025-04-03-233800_OrdenTrabajoFilesTable.php b/ci4/app/Database/Migrations/2025-04-03-233800_OrdenTrabajoFilesTable.php new file mode 100644 index 00000000..788b3518 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-04-03-233800_OrdenTrabajoFilesTable.php @@ -0,0 +1,63 @@ + [ + "type" => "INT", + "unsigned" => true, + "auto_increment" => true + ], + "orden_trabajo_id" => [ + "type" => "INT", + "unsigned" => true, + ], + "name" => [ + "type" => "TEXT", + ], + "upload_by" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "file_path" => [ + "type" => "TEXT", + ] + ]; + + 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->addPrimaryKey("id"); + $this->forge->addForeignKey("upload_by", "users", "id","CASCADE","CASCADE"); + $this->forge->addForeignKey("orden_trabajo_id", "ordenes_trabajo", "id","CASCADE","CASCADE"); + $this->forge->createTable("orden_trabajo_files", true); + } + + public function down() + { + $this->forge->dropTable("orden_trabajo_files"); + } +}