migrations remove index name

This commit is contained in:
xiaomlove
2026-04-20 22:41:09 +07:00
parent dfe9436f1d
commit 94a35b81dc
23 changed files with 36 additions and 34 deletions
@@ -17,7 +17,7 @@ class CreateAgentAllowedExceptionTable extends Migration
return;
}
Schema::create('agent_allowed_exception', function (Blueprint $table) {
$table->unsignedTinyInteger('family_id')->default(0)->index('family_id');
$table->unsignedTinyInteger('family_id')->default(0)->index();
$table->string('name', 100)->default('');
$table->string('peer_id', 20)->default('');
$table->string('agent', 100)->default('');
@@ -22,7 +22,7 @@ class CreateAttachmentsTable extends Migration
$table->unsignedSmallInteger('width')->default(0);
$table->dateTime('added')->nullable();
$table->string('filename')->default('');
$table->char('dlkey', 32)->index('idx_delkey');
$table->char('dlkey', 32)->index();
$table->string('filetype', 50)->default('');
$table->unsignedBigInteger('filesize')->default(0);
$table->string('location')->default('');
@@ -30,7 +30,7 @@ class CreateAttachmentsTable extends Migration
$table->smallInteger('isimage')->unsigned()->default(0);
$table->smallInteger('thumb')->unsigned()->default(0);
$table->index(['userid', 'id'], 'pid');
$table->index(['added', 'isimage', 'downloads'], 'dateline');
$table->index(['added', 'isimage', 'downloads'], );
});
}
@@ -18,7 +18,7 @@ class CreateAttendanceTable extends Migration
}
Schema::create('attendance', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('uid')->default(0)->index('idx_uid');
$table->unsignedInteger('uid')->default(0)->index();
$table->dateTime('added')->index();
$table->unsignedInteger('points')->default(0);
$table->unsignedInteger('days')->default(1);
@@ -23,7 +23,7 @@ class CreateBansTable extends Migration
$table->string('comment')->default('');
$table->bigInteger('first')->default(0);
$table->bigInteger('last')->default(0);
$table->index(['first', 'last'], 'first_last');
$table->index(['first', 'last'], );
});
}
@@ -20,7 +20,7 @@ class CreateBlocksTable extends Migration
$table->increments('id');
$table->unsignedMediumInteger('userid')->default(0);
$table->unsignedMediumInteger('blockid')->default(0);
$table->unique(['userid', 'blockid'], 'userfriend');
$table->unique(['userid', 'blockid'],);
});
}
@@ -20,7 +20,7 @@ class CreateBookmarksTable extends Migration
$table->increments('id');
$table->unsignedMediumInteger('torrentid')->default(0);
$table->unsignedMediumInteger('userid')->default(0);
$table->index(['userid', 'torrentid'], 'userid_torrentid');
$table->index(['userid', 'torrentid'], );
});
}
@@ -24,7 +24,7 @@ class CreateCategoriesTable extends Migration
$table->string('image')->default('');
$table->unsignedSmallInteger('sort_index')->default(0);
$table->integer('icon_id')->default(0);
$table->index(['mode', 'sort_index'], 'mode_sort');
$table->index(['mode', 'sort_index'], );
});
}
@@ -19,7 +19,7 @@ class CreateChronicleTable extends Migration
Schema::create('chronicle', function (Blueprint $table) {
$table->mediumIncrements('id');
$table->unsignedMediumInteger('userid')->default(0);
$table->dateTime('added')->nullable()->index('added');
$table->dateTime('added')->nullable()->index();
$table->text('txt')->nullable();
});
}
@@ -18,7 +18,7 @@ class CreateCommentsTable extends Migration
}
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->unsignedMediumInteger('user')->default(0)->index('user');
$table->unsignedMediumInteger('user')->default(0)->index();
$table->unsignedMediumInteger('torrent')->default(0);
$table->dateTime('added')->nullable();
$table->text('text')->nullable();
@@ -28,8 +28,8 @@ class CreateCommentsTable extends Migration
$table->unsignedMediumInteger('offer')->default(0);
$table->integer('request')->default(0);
$table->enum('anonymous', ['yes', 'no'])->default('no');
$table->index(['torrent', 'id'], 'torrent_id');
$table->index(['offer', 'id'], 'offer_id');
$table->index(['torrent', 'id'], );
$table->index(['offer', 'id'], );
});
}
@@ -18,7 +18,7 @@ class CreateFilesTable extends Migration
}
Schema::create('files', function (Blueprint $table) {
$table->increments('id');
$table->unsignedMediumInteger('torrent')->default(0)->index('torrent');
$table->unsignedMediumInteger('torrent')->default(0)->index();
$table->string('filename')->default('');
$table->unsignedBigInteger('size')->default(0);
});
@@ -18,7 +18,7 @@ class CreateForummodsTable extends Migration
}
Schema::create('forummods', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('forumid')->default(0)->index('forumid');
$table->unsignedSmallInteger('forumid')->default(0)->index();
$table->unsignedMediumInteger('userid')->default(0);
});
}
@@ -20,7 +20,7 @@ class CreateInvitesTable extends Migration
$table->increments('id');
$table->unsignedMediumInteger('inviter')->default(0);
$table->string('invitee', 80)->default('');
$table->char('hash', 32)->index('hash');
$table->char('hash', 32)->index();
$table->dateTime('time_invited')->nullable();
$table->tinyInteger('valid')->default(1);
$table->integer('invitee_register_uid')->nullable();
@@ -19,7 +19,7 @@ class CreateIplogTable extends Migration
Schema::create('iplog', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('ip', 64)->default('');
$table->unsignedMediumInteger('userid')->default(0)->index('userid');
$table->unsignedMediumInteger('userid')->default(0)->index();
$table->dateTime('access')->nullable();
});
}
@@ -18,8 +18,8 @@ class CreateMagicTable extends Migration
}
Schema::create('magic', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('torrentid')->default(0)->index('idx_torrentid');
$table->integer('userid')->default(0)->index('idx_userid');
$table->integer('torrentid')->default(0)->index();
$table->integer('userid')->default(0)->index();
$table->integer('value')->default(0);
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
@@ -18,8 +18,8 @@ class CreateMessagesTable extends Migration
}
Schema::create('messages', function (Blueprint $table) {
$table->increments('id');
$table->unsignedMediumInteger('sender')->default(0)->index('sender');
$table->unsignedMediumInteger('receiver')->default(0)->index('receiver');
$table->unsignedMediumInteger('sender')->default(0)->index();
$table->unsignedMediumInteger('receiver')->default(0)->index();
$table->dateTime('added')->nullable();
$table->string('subject', 128)->default('');
$table->text('msg')->nullable();
@@ -18,7 +18,7 @@ class CreateResreqTable extends Migration
}
Schema::create('resreq', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('reqid')->default(0)->index('reqid');
$table->integer('reqid')->default(0)->index();
$table->integer('torrentid')->default(0);
$table->enum('chosen', ['yes', 'no'])->default('no');
});
@@ -18,7 +18,7 @@ class CreateSettingsTable extends Migration
}
Schema::create('settings', function (Blueprint $table) {
$table->integer('id', true);
$table->string('name')->default('')->unique('uniqe_name');
$table->string('name')->default('')->unique();
$table->mediumText('value')->nullable();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
@@ -28,7 +28,7 @@ class CreateSubsTable extends Migration
$table->enum('anonymous', ['yes', 'no'])->default('no');
$table->unsignedMediumInteger('hits')->default(0);
$table->string('ext', 10)->default('');
$table->index(['torrent_id', 'lang_id'], 'torrentid_langid');
$table->index(['torrent_id', 'lang_id'],);
});
}
@@ -18,9 +18,9 @@ class CreateSuggestTable extends Migration
}
Schema::create('suggest', function (Blueprint $table) {
$table->increments('id');
$table->string('keywords')->default('')->index('keywords');
$table->string('keywords')->default('')->index();
$table->unsignedMediumInteger('userid')->default(0);
$table->dateTime('adddate')->nullable()->index('adddate');
$table->dateTime('adddate')->nullable()->index();
});
}
@@ -19,7 +19,7 @@ class CreateTorrentsTable extends Migration
Schema::create('torrents', function (Blueprint $table) {
$table->mediumIncrements('id');
$table->binary('info_hash', 20)->nullable()->unique();
$table->string('name')->default('')->index('name');
$table->string('name')->default('')->index();
$table->string('filename')->default('');
$table->string('save_as')->default('');
$table->text('descr')->nullable();
@@ -46,13 +46,13 @@ class CreateTorrentsTable extends Migration
$table->dateTime('last_action')->nullable();
$table->enum('visible', ['yes', 'no'])->default('yes');
$table->enum('banned', ['yes', 'no'])->default('no');
$table->unsignedMediumInteger('owner')->default(0)->index('owner');
$table->unsignedMediumInteger('owner')->default(0)->index();
$table->binary('nfo')->nullable();
$table->unsignedTinyInteger('sp_state')->default(1);
$table->unsignedTinyInteger('promotion_time_type')->default(0);
$table->dateTime('promotion_until')->nullable();
$table->enum('anonymous', ['yes', 'no'])->default('no');
$table->unsignedInteger('url')->nullable()->index('url');
$table->unsignedInteger('url')->nullable()->index();
$table->string('pos_state', 32)->default('normal');
$table->unsignedTinyInteger('cache_stamp')->default(0);
$table->enum('picktype', ['hot', 'classic', 'recommended', 'normal'])->default('normal');
@@ -60,9 +60,9 @@ class CreateTorrentsTable extends Migration
$table->dateTime('last_reseed')->nullable();
$table->mediumText('pt_gen')->nullable();
$table->text('technical_info')->nullable();
$table->index(['visible', 'pos_state', 'id'], 'visible_pos_id');
$table->index(['category', 'visible', 'banned'], 'category_visible_banned');
$table->index(['visible', 'banned', 'pos_state', 'id'], 'visible_banned_pos_id');
$table->index(['visible', 'pos_state', 'id'] );
$table->index(['category', 'visible', 'banned']);
$table->index(['visible', 'banned', 'pos_state', 'id']);
});
// $sql = 'alter table torrents add column `info_hash` binary(20) NOT NULL after id, add unique info_hash(`info_hash`)';
// \Illuminate\Support\Facades\DB::statement($sql);
@@ -16,7 +16,7 @@ return new class extends Migration
Schema::table('invites', function (Blueprint $table) {
$table->dateTime('expired_at')->nullable(true)->index();
$table->dateTime('created_at')->useCurrent();
$table->index(['inviter'], 'idx_inviter');
$table->index(['inviter'], );
});
}
@@ -14,7 +14,7 @@ return new class extends Migration
public function up()
{
Schema::table('claims', function (Blueprint $table) {
$table->index("created_at", "idx_created_at");
$table->index("created_at", );
});
}
+3 -1
View File
@@ -178,7 +178,9 @@ function dltable($name, $arr, $torrent, &$isSeedBoxCaseWhens)
$downloaders = $seedersAndLeechers['leechers'];
do_log("SEEDER_LEECHER_FROM_FILTER: torrent_seeder_leecher_list");
} else {
$subres = sql_query("SELECT id, seeder, finishedat, downloadoffset, uploadoffset, ip, ipv4, ipv6, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
$startedField = \Nexus\Database\NexusDB::unixTimestampField('started');
$lastActionField = \Nexus\Database\NexusDB::unixTimestampField('last_action');
$subres = sql_query("SELECT id, seeder, finishedat, downloadoffset, uploadoffset, ip, ipv4, ipv6, port, uploaded, downloaded, to_go, $startedField AS st, connectable, agent, peer_id, $lastActionField AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
while ($subrow = mysql_fetch_array($subres)) {
if ($subrow["seeder"] == "yes")
$seeders[] = $subrow;