mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
27 lines
860 B
PHP
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');
|
|
}
|
|
}
|