mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:01:24 +00:00
Update migrations and remove unnecessary ones
This commit is contained in:
@@ -25,11 +25,8 @@ class CreateCategoryRegexesTable extends Migration
|
||||
$table->smallInteger('categories_id')->unsigned()->default(10)->index('ix_category_regexes_categories_id')->comment('Which categories id to put the release in');
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE category_regexes AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE category_regexes_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE category_regexes AUTO_INCREMENT = 100000;');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,11 +24,8 @@ class CreateCollectionRegexesTable extends Migration
|
||||
$table->integer('ordinal')->default(0)->index('ix_collection_regexes_ordinal')->comment('Order to run the regex in');
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE collection_regexes AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE collection_regexes_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE collection_regexes AUTO_INCREMENT = 100000;');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,11 +26,8 @@ class CreateBinaryblacklistTable extends Migration
|
||||
$table->date('last_activity')->nullable();
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE binaryblacklist AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE binaryblacklist_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE binaryblacklist AUTO_INCREMENT = 100000;');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,11 +30,8 @@ class CreateContentTable extends Migration
|
||||
$table->index(['showinmenu', 'status', 'contenttype', 'role'], 'ix_showinmenu_status_contenttype_role');
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE content AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE content_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE content AUTO_INCREMENT = 100000;');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,8 @@ class CreateGenresTable extends Migration
|
||||
$table->boolean('disabled')->default(0);
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE genres AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE genres_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE genres AUTO_INCREMENT = 100000;');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-7
@@ -3,7 +3,7 @@
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateGroupsTable extends Migration
|
||||
class CreateUsenetGroupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
@@ -12,7 +12,7 @@ class CreateGroupsTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('groups', function (Blueprint $table) {
|
||||
Schema::create('usenet_groups', function (Blueprint $table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
@@ -31,11 +31,8 @@ class CreateGroupsTable extends Migration
|
||||
$table->string('description')->nullable()->default('');
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE groups AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE groups_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE usenet_groups AUTO_INCREMENT = 100000;');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,11 +24,9 @@ class CreateReleaseNamingRegexesTable extends Migration
|
||||
$table->integer('ordinal')->default(0)->index('ix_release_naming_regexes_ordinal')->comment('Order to run the regex in');
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
DB::statement('ALTER TABLE release_naming_regexes AUTO_INCREMENT = 100000;');
|
||||
} else {
|
||||
DB::statement('ALTER SEQUENCE release_naming_regexes_id_seq RESTART 1000000;');
|
||||
}
|
||||
DB::statement('ALTER TABLE release_naming_regexes AUTO_INCREMENT = 100000;');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,11 +77,10 @@ processed');
|
||||
$table->index(['haspreview', 'passwordstatus'], 'ix_releases_haspreview_passwordstatus');
|
||||
$table->index(['nfostatus', 'size'], 'ix_releases_nfostatus');
|
||||
$table->index(['dehashstatus', 'ishashed'], 'ix_releases_dehashstatus');
|
||||
$table->binary('nzb_guid')->index('ix_releases_nzb_guid');
|
||||
});
|
||||
|
||||
DB::statement('ALTER TABLE releases DROP PRIMARY KEY , ADD PRIMARY KEY (id, categories_id)');
|
||||
DB::statement('ALTER TABLE releases ADD COLUMN nzb_guid BINARY(16) NULL');
|
||||
DB::statement('ALTER TABLE releases ADD INDEX ix_releases_nzb_guid (nzb_guid)');
|
||||
|
||||
Trigger::table('releases')->key('check_insert')->beforeInsert(function () {
|
||||
return 'IF NEW.searchname REGEXP "[a-fA-F0-9]{32}" OR NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
|
||||
|
||||
@@ -16,7 +16,8 @@ class CreateBinariesTable extends Migration
|
||||
$table->engine = 'InnoDB';
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->bigInteger('id', true)->unsigned();
|
||||
$table->id();
|
||||
$table->binary('binaryhash')->default('0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0')->index('ix_binaries_binaryhash');
|
||||
$table->string('name', 1000)->default('');
|
||||
$table->integer('collections_id')->unsigned()->default(0)->index('ix_binaries_collection');
|
||||
$table->integer('filenumber')->unsigned()->default(0);
|
||||
@@ -24,11 +25,9 @@ class CreateBinariesTable extends Migration
|
||||
$table->integer('currentparts')->unsigned()->default(0);
|
||||
$table->boolean('partcheck')->default(0)->index('ix_binaries_partcheck');
|
||||
$table->bigInteger('partsize')->unsigned()->default(0);
|
||||
$table->unique(['collections_id', 'filenumber'], 'ux_collection_id_filenumber');
|
||||
$table->foreign('collections_id', 'FK_Collections')->references('id')->on('collections')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
DB::statement("ALTER TABLE binaries ADD COLUMN binaryhash BINARY(16) NOT NULL DEFAULT '0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'");
|
||||
DB::statement('ALTER TABLE binaries ADD UNIQUE INDEX ix_binaries_binaryhash (binaryhash)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,8 +31,8 @@ class CreateBookinfoTable extends Migration
|
||||
$table->string('genre');
|
||||
$table->boolean('cover')->default(0);
|
||||
$table->timestamps();
|
||||
$table->fullText(['author', 'title'], 'ix_bookinfo_author_title_ft');
|
||||
});
|
||||
DB::statement('ALTER TABLE bookinfo ADD FULLTEXT ix_bookinfo_author_title_ft (author, title)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,8 +29,8 @@ class CreateConsoleinfoTable extends Migration
|
||||
$table->string('review', 3000)->nullable();
|
||||
$table->boolean('cover')->default(0);
|
||||
$table->timestamps();
|
||||
$table->fullText(['title', 'platform'], 'ix_consoleinfo_title_platform_ft');
|
||||
});
|
||||
DB::statement('ALTER TABLE consoleinfo ADD FULLTEXT ix_consoleinfo_title_platform_ft (title, platform)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,9 +30,8 @@ class CreateGamesinfoTable extends Migration
|
||||
$table->string('trailer', 1000)->default('');
|
||||
$table->string('classused', 10)->default('steam');
|
||||
$table->timestamps();
|
||||
$table->fullText('title', 'ix_title_ft');
|
||||
});
|
||||
|
||||
DB::statement('ALTER TABLE gamesinfo ADD FULLTEXT ix_title_ft(title)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,8 +30,8 @@ class CreateMusicinfoTable extends Migration
|
||||
$table->string('tracks', 3000)->nullable();
|
||||
$table->boolean('cover')->default(0);
|
||||
$table->timestamps();
|
||||
$table->fulltext(['artist', 'title'], 'ix_musicinfo_artist_title_ft');
|
||||
});
|
||||
DB::statement('ALTER TABLE musicinfo ADD FULLTEXT ix_musicinfo_artist_title_ft (artist, title)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,8 +32,8 @@ class CreatePredbTable extends Migration
|
||||
$table->string('filename')->default('');
|
||||
$table->boolean('searched')->default(0)->index('ix_predb_searched');
|
||||
$table->index(['requestid', 'groups_id'], 'ix_predb_requestid');
|
||||
$table->fullText('filename', 'ft_predb_filename');
|
||||
});
|
||||
DB::statement('ALTER TABLE predb ADD FULLTEXT ft_predb_filename (filename)');
|
||||
Trigger::table('predb')->key('insert_hashes')->afterInsert(function () {
|
||||
return 'INSERT INTO predb_hashes (hash, predb_id) VALUES (UNHEX(MD5(NEW.title)), NEW.id), (UNHEX(MD5(MD5(NEW.title))), NEW.id), (UNHEX(SHA1(NEW.title)), NEW.id), (UNHEX(SHA2(NEW.title, 256)), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid))), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid, NEW.requestid))), NEW.id);';
|
||||
});
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateSharingTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sharing', function (Blueprint $table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->string('site_guid', 40)->default('')->primary();
|
||||
$table->string('site_name')->default('');
|
||||
$table->string('username')->default('');
|
||||
$table->boolean('enabled')->default(0);
|
||||
$table->boolean('posting')->default(0);
|
||||
$table->boolean('fetching')->default(1);
|
||||
$table->boolean('auto_enable')->default(1);
|
||||
$table->boolean('start_position')->default(0);
|
||||
$table->boolean('hide_users')->default(1);
|
||||
$table->bigInteger('last_article')->unsigned()->default(0);
|
||||
$table->integer('max_push')->unsigned()->default(40);
|
||||
$table->integer('max_download')->unsigned()->default(150);
|
||||
$table->integer('max_pull')->unsigned()->default(20000);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('sharing');
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateSharingSitesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sharing_sites', function (Blueprint $table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->increments('id');
|
||||
$table->string('site_name')->default('');
|
||||
$table->string('site_guid', 40)->default('');
|
||||
$table->dateTime('last_time')->nullable();
|
||||
$table->dateTime('first_time')->nullable();
|
||||
$table->boolean('enabled')->default(0);
|
||||
$table->integer('comments')->unsigned()->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('sharing_sites');
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,8 @@ class CreateSteamAppsTable extends Migration
|
||||
$table->string('name')->default('')->comment('Steam application name');
|
||||
$table->integer('appid')->unsigned()->comment('Steam application id');
|
||||
$table->primary(['appid', 'name']);
|
||||
$table->fullText('name', 'ix_name_ft');
|
||||
});
|
||||
|
||||
DB::statement('ALTER TABLE steam_apps ADD FULLTEXT ix_name_ft (name)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateBinariesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('binaries', function (Blueprint $table) {
|
||||
$table->unique(['collections_id', 'filenumber'], 'ux_collection_id_filenumber');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenameGroupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::rename('groups', 'usenet_groups');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class CreateFailedJobsTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->id();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateRootCategoriesTable extends Migration
|
||||
$table->engine = 'InnoDB';
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->bigIncrements('id');
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->integer('status')->default(1)->index('ix_root_categories_status');
|
||||
$table->boolean('disablepreview')->default(0);
|
||||
|
||||
@@ -14,7 +14,7 @@ class CreateRoleExpirationEmailsTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('role_expiration_emails', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->id();
|
||||
$table->integer('users_id')->unique();
|
||||
$table->timestamps();
|
||||
$table->boolean('day')->default(false);
|
||||
|
||||
@@ -13,7 +13,7 @@ class CreateInvitationUserTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_invitations', function (Blueprint $table) {
|
||||
$table->BigIncrements('id');
|
||||
$table->id();
|
||||
$table->string('code')->index();
|
||||
$table->string('email');
|
||||
$table->BigInteger('user_id')->unsigned();
|
||||
|
||||
@@ -14,7 +14,7 @@ class CreatePaypalPaymentsTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('paypal_payments', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->id();
|
||||
$table->integer('users_id');
|
||||
$table->string('transaction_id');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -14,7 +14,7 @@ class CreateJobsTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
|
||||
Reference in New Issue
Block a user