Some query optimisations when rendering status, dashboard, about and FTN list pages
This commit is contained in:
parent
67f0e3007e
commit
2d75c92afb
38
database/migrations/2024_09_10_indexes.php
Normal file
38
database/migrations/2024_09_10_indexes.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('echomails', function (Blueprint $table) {
|
||||||
|
$table->index(['created_at']);
|
||||||
|
$table->index(['datetime']);
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::statement('CREATE INDEX echomail_seenby_unsent ON echomail_seenby (address_id,echomail_id) WHERE sent_at IS NULL AND export_at IS NOT NULL;');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('echomails', function (Blueprint $table) {
|
||||||
|
$table->dropIndex(['created_at']);
|
||||||
|
$table->dropIndex(['datetime']);
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::statement('DROP INDEX echomail_seenby_unsent');
|
||||||
|
}
|
||||||
|
};
|
@ -39,7 +39,7 @@ use App\Models\{Address,Domain};
|
|||||||
<td class="text-end">{{ $do->active ? 'Active' : 'Not Active' }}</td>
|
<td class="text-end">{{ $do->active ? 'Active' : 'Not Active' }}</td>
|
||||||
<td class="text-end">{{ $do->isManaged() ? 'YES' : 'NO' }}</td>
|
<td class="text-end">{{ $do->isManaged() ? 'YES' : 'NO' }}</td>
|
||||||
<td>
|
<td>
|
||||||
@foreach (($x=$do->zones->pluck('addresses')->flatten())->where('role_id',Address::NODE_ZC)->sortBy('zone.zone_id') as $ao)
|
@foreach (($x=$do->zones->pluck('addresses')->flatten())->filter(fn($item)=>$item->node_id === 0)->where('role_id',Address::NODE_ZC)->sortBy('zone.zone_id') as $ao)
|
||||||
{{ $ao->system->sysop }}, <a href="{{ url('system/view',$ao->system_id) }}">{{ $ao->system->name }}</a><br>
|
{{ $ao->system->sysop }}, <a href="{{ url('system/view',$ao->system_id) }}">{{ $ao->system->name }}</a><br>
|
||||||
@endforeach
|
@endforeach
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user