Files
safekat/ci4/app/Database/Migrations/2025-06-09-102500_CreateBackupsTable.php
imnavajas 6967a61d93 Avances
2025-06-09 15:18:12 +02:00

33 lines
1.2 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateBackupsTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true
],
'filename' => ['type' => 'VARCHAR', 'constraint' => 255],
'type' => ['type' => 'ENUM', 'constraint' => ['manual', 'cron']],
'path_local' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'path_remote' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'size' => ['type' => 'INT', 'unsigned' => true, 'null' => true],
'status' => ['type' => 'ENUM', 'constraint' => ['pendiente', 'subido', 'error'], 'default' => 'pendiente'],
'created_at' => ['type' => 'DATETIME', 'null' => false],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->createTable('backups');
}
public function down()
{
$this->forge->dropTable('backups');
}
}