<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTemplateAttachmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
		Schema::create('template_attachments', function (Blueprint $table) {
			$table->id();
			$table->unsignedBigInteger('template_id');
			$table->string('title');
			$table->string('file_name');
			$table->string('file_type');
			$table->string('file_size');
			$table->string('file_extension');
			$table->timestamps();
			
			$table->foreign('template_id')->references('id')->on('templates')->onDelete('cascade');
		});
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('template_attachments');
    }
}
