Ekapp/skolehjem/database/migrations/2020_07_01_062544_create_re...

38 lines
915 B
PHP
Raw Normal View History

<?php
//Migrations acts as a version control for the database allowing you to modify the app's database schema
//allows use of necessary libraries
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateResource extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('resources', function (Blueprint $table) {
$table->id();
$table->string("filename")->unique();
$table->unsignedInteger("extension_id");
$table->timestamps();
$table->foreign("extension_id")->references("id")->on("resource_extensions");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('resources');
}
}