Files
lelong/database/migrations/2022_06_12_105248_create_fileresit_table.php
T
faiqahzaman f0043b7c18 update 14/6
2022-06-14 08:58:35 +08:00

48 lines
1.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFileresitTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fileresit', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('payment_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');
$table->foreign('payment_id')
->references('id')->on('payment')
->onDelete('cascade');
});
// once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
DB::statement("ALTER TABLE fileresit ADD filename LONGBLOB");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('fileresit');
}
}