Files
lelong/database/migrations/2022_01_13_064027_create_file_table.php
ismailmasseran e29a5891c8 Bugfix/list clickup issue (#5)
Reviewed-on: #5
Co-authored-by: ISMAIL MASSERAN <ismail@koppkb.com>
Co-committed-by: ISMAIL MASSERAN <ismail@koppkb.com>
2026-10-19 13:30:36 +08:00

44 lines
1.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateFileTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('file', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->string('file_type');
$table->datetime('deleted_at')->nullable();
$table->integer('deleted_by')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
// once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
DB::statement('ALTER TABLE file ADD filename LONGBLOB');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('files');
}
}