added indexes to the database

This commit is contained in:
Peter Papp
2021-03-14 11:04:19 +01:00
parent 5778de20f2
commit 95eb167622
10 changed files with 15 additions and 17 deletions

View File

@@ -14,9 +14,9 @@ class CreateUsersTable extends Migration
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('id')->primary()->index();
$table->enum('role', ['admin', 'user'])->default('user');
$table->string('email')->unique();
$table->string('email')->unique()->index();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();

View File

@@ -14,8 +14,8 @@ class CreateFileManagerFolders extends Migration
public function up()
{
Schema::create('folders', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('user_id');
$table->uuid('id')->primary()->index();
$table->uuid('user_id')->index();
$table->uuid('parent_id')->nullable();
$table->text('name');
$table->string('color')->nullable();

View File

@@ -14,15 +14,15 @@ class CreateFileManagerFiles extends Migration
public function up()
{
Schema::create('files', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('user_id');
$table->uuid('id')->primary()->index();
$table->uuid('user_id')->index();
$table->uuid('folder_id')->nullable();
$table->text('thumbnail')->nullable();
$table->text('name');
$table->text('basename');
$table->text('mimetype')->nullable();
$table->text('mimetype')->nullable()->index();
$table->text('filesize');
$table->text('type')->nullable();

View File

@@ -17,7 +17,7 @@ class CreateSharesTable extends Migration
$table->uuid('id')->primary();
$table->uuid('user_id');
$table->uuid('item_id');
$table->string('token', 16)->unique();
$table->string('token', 16)->unique()->index();
$table->enum('type', ['file', 'folder']);
$table->enum('permission', ['visitor', 'editor'])->nullable();
$table->boolean('is_protected')->default(0);

View File

@@ -14,7 +14,7 @@ class CreateUserSettingsTable extends Migration
public function up()
{
Schema::create('user_settings', function (Blueprint $table) {
$table->uuid('user_id');
$table->uuid('user_id')->index();
$table->integer('storage_capacity')->default(5);
$table->string('avatar')->nullable();
$table->text('name')->nullable();

View File

@@ -14,7 +14,7 @@ class CreateSettingsTable extends Migration
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->string('name')->unique()->primary();
$table->string('name')->unique()->primary()->index();
$table->longText('value')->nullable();
});
}

View File

@@ -14,7 +14,7 @@ class CreatePagesTable extends Migration
public function up()
{
Schema::create('pages', function (Blueprint $table) {
$table->string('slug');
$table->string('slug')->index();
$table->string('title');
$table->boolean('visibility');
$table->longText('content');

View File

@@ -15,7 +15,7 @@ class CreateTrafficTable extends Migration
{
Schema::create('traffic', function (Blueprint $table) {
$table->uuid('id');
$table->uuid('user_id');
$table->uuid('user_id')->index();
$table->bigInteger('upload')->default(0);
$table->bigInteger('download')->default(0);
$table->timestamps();

View File

@@ -14,9 +14,9 @@ class CreateZipsTable extends Migration
public function up()
{
Schema::create('zips', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('user_id');
$table->string('shared_token')->nullable();
$table->uuid('id')->primary()->index();
$table->uuid('user_id')->index();
$table->string('shared_token')->nullable()->index();
$table->text('basename');
$table->timestamps();
});

View File

@@ -6,8 +6,6 @@ use App\Http\Controllers\User\PaymentMethodsController;
use App\Http\Controllers\User\SubscriptionController;
Route::post('/check', [AuthController::class, 'check_account']);
Route::post('/register', [AuthController::class, 'register']);
Route::post('/login', [AuthController::class, 'login']);
Route::group(['middleware' => ['auth:sanctum']], function () {