Skip to content

Instantly share code, notes, and snippets.

@Kindari
Created October 18, 2011 18:48
Show Gist options
  • Save Kindari/1296302 to your computer and use it in GitHub Desktop.
Save Kindari/1296302 to your computer and use it in GitHub Desktop.
<?php
namespace Fuel\Migrations;
class Create_sessions {
public function up()
{
\DBUtil::create_table('sessions', array(
'session_id' => array('constraint' => 40, 'type' => 'varchar'),
'previous_id' => array('constraint' => 40, 'type' => 'varchar'),
'user_agent' => array('type' => 'text'),
'ip_address' => array('constraint' => 16, 'type' => 'varchar'),
'created' => array('constraint' => 10, 'type' => 'int', 'default' => 0),
'updated' => array('constraint' => 10, 'type' => 'int', 'default' => 0),
'payload' => array('type' => 'longtext'),
), array('session_id'));
$query = \DB::query("ALTER TABLE sessions ADD UNIQUE `PREVIOUS` (previous_id);");
$query->execute();
}
public function down()
{
\DBUtil::drop_table('sessions');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment