mirror of
https://github.com/SophiaAtkinson/steamwidgets-web.git
synced 2025-06-27 14:37:41 -07:00
Stats
This commit is contained in:
51
app/migrations/HitsModel.php
Normal file
51
app/migrations/HitsModel.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Asatru PHP - Migration for hits
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class specifies a migration
|
||||
*/
|
||||
class HitsModel_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('hits', $this->connection);
|
||||
$this->database->drop();
|
||||
$this->database->add('id INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
|
||||
$this->database->add('hash_token VARCHAR(512) NOT NULL');
|
||||
$this->database->add('hittype VARCHAR(100) NOT 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user