38 lines
904 B
PHP
38 lines
904 B
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
|
||
|
class CreateSubjectsTable extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
Schema::create('subjects', function (Blueprint $table) {
|
||
|
$table->bigIncrements('id');
|
||
|
$table->string('name');
|
||
|
$table->string('type')->nullable();
|
||
|
$table->integer('room_id');
|
||
|
$table->integer('user_id');
|
||
|
$table->timestamps();
|
||
|
$table->foreign('room_id')->references('id')->on('rooms');
|
||
|
$table->foreign('user_id')->references('id')->on('users');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
Schema::dropIfExists('subjects');
|
||
|
}
|
||
|
}
|