Files
safekat/ci4/app/Database/Migrations/2025-06-09-110500_CreateRestoresTable.php
2025-06-12 14:57:48 +02:00

27 lines
860 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateRestoresTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'backup_id' => ['type' => 'INT', 'unsigned' => true],
'restored_by' => ['type' => 'VARCHAR', 'constraint' => 100],
'source' => ['type' => 'ENUM', 'constraint' => ['local', 'remote']],
'restored_at' => ['type' => 'DATETIME'],
]);
$this->forge->addKey('id', true);
$this->forge->addForeignKey('backup_id', 'backups', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('backup_restores');
}
public function down()
{
$this->forge->dropTable('backup_restores');
}
}