Browse Source

database migration

main
Holly McFarland 4 months ago
parent
commit
5343438ca6
1 changed files with 48 additions and 0 deletions
  1. +48
    -0
      database/migrations/2021_03_29_002752_init.php

+ 48
- 0
database/migrations/2021_03_29_002752_init.php View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Init extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
'rooms',
function (Blueprint $table) {
$table->id();
$table->integer('number');
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->integer('max_occupancy');
}
);
Schema::create(
'bookings',
function (Blueprint $table) {
$table->id();
$table->foreignId('room_id')->constrained('rooms');
$table->string('guest_name');
$table->date('date');
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bookings');
Schema::drop('rooms');
}
}

Loading…
Cancel
Save