forked from tuub/platzbuchung
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2020_06_08_220024_create_bookings_table.php
42 lines (39 loc) · 1.27 KB
/
2020_06_08_220024_create_bookings_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('bookings');
Schema::create('bookings', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->uuid('id')->primary();
$table->uuid('user_id');
$table->date('date');
$table->dateTimeTz('start');
$table->dateTimeTz('end');
$table->unsignedBigInteger('resource_id');
$table->unsignedBigInteger('time_slot_id');
$table->timestamps();
$table->foreign('resource_id')->references('id')->on('resources')->onUpdate('cascade')->onDelete('cascade');
$table->foreign('time_slot_id')->references('id')->on('time_slots')->onUpdate('cascade')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bookings');
}
}