v0.5.3 - Added Locations and a location_id to washing machines

This commit is contained in:
frederikpyt
2020-08-06 08:37:16 +02:00
parent 9b631843b0
commit 5452711665
22 changed files with 424 additions and 40 deletions
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLocationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('locations', function (Blueprint $table) {
$table->id();
$table->string("name")->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('locations');
}
}
@@ -17,8 +17,11 @@ class CreateWashingMachines extends Migration
{
Schema::create('washing_machines', function (Blueprint $table) {
$table->id();
$table->string("name")->unique();
$table->string("name");
$table->foreignId("location_id")->constrained("locations", "id");
$table->timestamps();
$table->unique(['name', 'location_id']);
});
}