You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlexShare/fuel/app/migrations/010_create_user_history.php

29 lines
1.1 KiB

<?php
namespace Fuel\Migrations;
class Create_user_history
{
public function up()
{
\DBUtil::create_table('user_history', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'user_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'movie_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'watching_time' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'ended_time' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 11),
'is_ended' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintUserUserHistory ON user_history(`user_id`)')->execute();
\DB::query('CREATE INDEX constraintMovieHistory ON user_history(`movie_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintUserUserHistory ON user_history')->execute();
\DB::query('DROP INDEX constraintMovieHistory ON user_history')->execute();
\DBUtil::drop_table('user_history');
}
}