Skip to content

Instantly share code, notes, and snippets.

@cs-sonar
Created July 16, 2013 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cs-sonar/6005861 to your computer and use it in GitHub Desktop.
Save cs-sonar/6005861 to your computer and use it in GitHub Desktop.
fuelphpのセッションテーブルを作るmigrationファイル
<?php
namespace Fuel\Migrations;
class Create_sessions
{
public function up()
{
\DBUtil::create_table('sessions', array(
'session_id' => array('constraint' => 40, 'type' => 'varchar', 'null' =>false),
'previous_id' => array('constraint' => 40, 'type' => 'varchar', 'null' => false),
'user_agent' => array('type' => 'text'),
'ip_hash' => array('type' => 'char', 'constraint' => 32, 'default' => '', 'null' => false),
'created' => array('type' => 'int', 'constraint' => 10, 'null' => false, 'default' => 0, 'unsigned' => true),
'updated' => array('type' => 'int', 'constraint' => 10, 'null' => false, 'default' => 0, 'unsigned' => true),
'payload' => array('type' => 'text', ' null' => false)
), array('session_id'), true, 'InnoDB','utf8_unicode_ci');
\Fuel\Core\DBUtil::create_index('sessions', 'previous_id', 'PREVIOUS', 'UNIQUE');
}
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