Fix migrations files

master
root 2 years ago
parent 014a97e5d2
commit 56a57fe555

@ -1,20 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_configurations
{
public function up()
{
\DBUtil::create_table('configurations', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'name' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'data' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
), array('id'));
}
public function down()
{
\DBUtil::drop_table('configurations');
}
}

@ -1,30 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_library
{
public function up()
{
\DBUtil::create_table('library', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'server_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'plex_key' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'name' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'type' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'updatedAt' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'createdAt' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'scannedAt' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintServerLibrary ON ' . \DB::table_prefix('library') . '(`server_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintServerLibrary ON ' . \DB::table_prefix('library'))->execute();
\DBUtil::drop_table('library');
}
}

@ -1,28 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_library_permission
{
public function up()
{
\DBUtil::create_table('library_permission', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'permission_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'library_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'value' => array('type' => 'varchar', 'null' => true, 'constraint' => 36),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintPermissionLibrariesPermission ON ' . \DB::table_prefix('library_permission') . '(`permission_id`)')->execute();
\DB::query('CREATE INDEX constraintLibraryLibrariesPermission ON ' . \DB::table_prefix('library_permission') . '(`library_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintPermissionLibrariesPermission ON ' . \DB::table_prefix('library_permission'))->execute();
\DB::query('DROP INDEX constraintLibraryLibrariesPermission ON ' . \DB::table_prefix('library_permission'))->execute();
\DBUtil::drop_table('library_permission');
}
}

@ -1,44 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_movie
{
public function up()
{
\DBUtil::create_table('movie', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'library_id' => array('type' => 'varchar', 'null' => true, 'constraint' => 36),
'season_id' => array('type' => 'varchar', 'null' => true, 'constraint' => 36),
'plex_key' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'type' => array('type' => 'varchar', 'null' => false, 'constraint' => 20),
'number' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'studio' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'title' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'originalTitle' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'summary' => array('type' => 'text', 'null' => true),
'rating' => array('type' => 'varchar', 'null' => true, 'constraint' => 4),
'year' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'thumb' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'art' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'duration' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'originallyAvailableAt' => array('type' => 'varchar', 'null' => true, 'constraint' => 11),
'addedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'updatedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintMovieLibrary ON ' . \DB::table_prefix('movie') . '(`library_id`)')->execute();
\DB::query('CREATE INDEX constraintMovieSeason ON ' . \DB::table_prefix('movie') . '(`season_id`)')->execute();
\DB::query('CREATE FULLTEXT searchTitle ON ' . \DB::table_prefix('movie') . '(`title` DESC)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintMovieLibrary ON ' . \DB::table_prefix('movie'))->execute();
\DB::query('DROP INDEX constraintMovieSeason ON ' . \DB::table_prefix('movie'))->execute();
\DB::query('DROP FULLTEXT searchTitle ON ' . \DB::table_prefix('movie'))->execute();
\DBUtil::drop_table('movie');
}
}

@ -1,30 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_permission
{
public function up()
{
\DBUtil::create_table('permission', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'name' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'parameters' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_WATCH_DISABLED'])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_DOWNLOAD_DISABLED'])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_TRAILER_DISABLED'])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_MAX_WATCH', 'parameters' => 1])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_MAX_QUALITY', 'parameters' => 1])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_MAX_CONCURRENT_STREAM', 'parameters' => 1])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_MAX_DOWNLOAD', 'parameters' => 1])->execute();
\DB::insert('permission')->set(['id' => \Str::random('uuid'), 'name' => 'RIGHT_MAX_DOWNLOAD_SPEED', 'parameters' => 1])->execute();
}
public function down()
{
\DBUtil::drop_table('permission');
}
}

@ -1,32 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_season
{
public function up()
{
\DBUtil::create_table('season', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'tv_show_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'plex_key' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'number' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'title' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'thumb' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'art' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'leafCount' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'addedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'updatedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintSeasonTvShow ON ' . \DB::table_prefix('season') . '(`tv_show_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintSeasonTvShow ON ' . \DB::table_prefix('season'))->execute();
\DBUtil::drop_table('season');
}
}

@ -1,35 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_server
{
public function up()
{
\DBUtil::create_table('server', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'user_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'https' => array('type' => 'int', 'null' => false, 'constraint' => 1),
'url' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'port' => array('type' => 'int', 'null' => true, 'constraint' => 2),
'token' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'lastcheck' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'name' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'plateforme' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'platformVersion' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'updatedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'version' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'online' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintServerUser ON ' . \DB::table_prefix('server') . '(`user_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintServerUser ON ' . \DB::table_prefix('server'))->execute();
\DBUtil::drop_table('server');
}
}

@ -1,39 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_tvshow
{
public function up()
{
\DBUtil::create_table('tvshow', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'library_id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'plex_key' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'studio' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'title' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'contentRating' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'summary' => array('type' => 'text', 'null' => true),
'rating' => array('type' => 'varchar', 'null' => true, 'constraint' => 4),
'year' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'thumb' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'art' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'banner' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'theme' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'originallyAvailableAt' => array('type' => 'varchar', 'null' => true, 'constraint' => 255),
'leafCount' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'addedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'updatedAt' => array('type' => 'int', 'null' => true, 'constraint' => 11),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintTvShowLibrary ON ' . \DB::table_prefix('tvshow') . '(`library_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintTvShowLibrary ON ' . \DB::table_prefix('tvshow'))->execute();
\DBUtil::drop_table('tvshow');
}
}

@ -1,29 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_user
{
public function up()
{
\DBUtil::create_table('user', array(
'id' => array('type' => 'varchar', 'null' => false, 'constraint' => 36),
'username' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'email' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'password' => array('type' => 'varchar', 'null' => false, 'constraint' => 255),
'admin' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
'lastlogin' => array('type' => 'int', 'null' => false, 'constraint' => 11),
'parent_id' => array('type' => 'varchar', 'null' => true, 'constraint' => 36),
'disable' => array('default' => '0', 'type' => 'int', 'null' => false, 'constraint' => 1),
), array('id'));
\DB::query('CREATE INDEX constraintUserUser ON ' . \DB::table_prefix('user') . '(`parent_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintUserUser ON ' . \DB::table_prefix('season'))->execute();
\DBUtil::drop_table('user');
}
}

@ -1,27 +0,0 @@
<?php
namespace Fuel\Migrations;
class Create_user_download
{
public function up()
{
\DBUtil::create_table('user_download', 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),
'date' => array('type' => 'int', 'null' => false, 'constraint' => 11),
), array('id'));
\DB::query('CREATE INDEX constraintDownloadUser ON ' . \DB::table_prefix('user_download') . '(`user_id`)')->execute();
\DB::query('CREATE INDEX constraintDownloadMovie ON ' . \DB::table_prefix('user_download') . '(`movie_id`)')->execute();
}
public function down()
{
\DB::query('DROP INDEX constraintDownloadUser ON ' . \DB::table_prefix('user_download'))->execute();
\DB::query('DROP INDEX constraintDownloadMovie ON ' . \DB::table_prefix('user_download'))->execute();
\DBUtil::drop_table('user_download');
}
}
Loading…
Cancel
Save