Ekapp/skolehjem/database/migrations/2020_06_29_091545_create_ev...

39 lines
965 B
PHP

<?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 CreateEvents extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('events', function (Blueprint $table) {
$table->id();
$table->string("name");
$table->string("accountable");
$table->longText("description");
$table->dateTime("date");
$table->foreignId('resource_id')->nullable()->constrained('resources', 'id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('events');
}
}