laravel-vue-file-share/database/migrations/2023_09_25_232212_create_files_table.php
2023-10-08 14:20:03 -07:00

36 lines
979 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('files', function (Blueprint $table) {
$table->id();
$table->string('name', 256);
$table->string('path', 1024)->nullable();
$table->nestedSet();
$table->boolean('is_folder');
$table->string('mimetype')->nullable();
$table->integer('size')->nullable();
$table->timestamps();
$table->foreignIdFor(\App\Models\User::class, 'created_by');
$table->foreignIdFor(\App\Models\User::class, 'updated_by');
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('files');
}
};