tethys/database/migrations/2017_06_01_100607_create_transactions_table.php

47 lines
1.1 KiB
PHP
Raw Normal View History

2018-08-06 12:30:51 +00:00
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTransactionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transactions', function(Blueprint $table)
{
$table->increments('id');
$table->integer('student_id')->unsigned();
$table->foreign('student_id')->references('id')->on('students');
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('books');
$table->integer('borrowed_at');
$table->integer('returned_at')->default('0');
$table->integer('fines')->default('0');
$table->boolean('status')->default('0');
$table->timestamps();
});
// Schema::table('transactions', function($table) {
// $table->foreign('student_id')->references('id')->on('students');
// });
// Schema::table('transactions', function($table) {
// $table->foreign('book_id')->references('id')->on('books');
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('transactions');
}
}