Files
hortusfox-web/app/migrations/LogModel.php
2025-02-03 22:02:23 +01:00

50 lines
1.3 KiB
PHP

<?php
/**
* Class LogModel_Migration
*/
class LogModel_Migration {
private $database = null;
private $connection = null;
/**
* Store the PDO connection handle
*
* @param \PDO $pdo The PDO connection handle
* @return void
*/
public function __construct($pdo)
{
$this->connection = $pdo;
}
/**
* Called when the table shall be created or modified
*
* @return void
*/
public function up()
{
$this->database = new Asatru\Database\Migration('LogModel', $this->connection);
$this->database->drop();
$this->database->add('id INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
$this->database->add('user INT NOT NULL');
$this->database->add('target VARCHAR(512) NOT NULL');
$this->database->add('property VARCHAR(512) NOT NULL');
$this->database->add('value VARCHAR(1024) NOT NULL');
$this->database->add('link VARCHAR(512) NULL');
$this->database->add('created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP');
$this->database->create();
}
/**
* Called when the table shall be dropped
*
* @return void
*/
public function down()
{
if ($this->database)
$this->database->drop();
}
}