2021-01-07 18:45:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
|
|
class CreateDevicesTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('devices', function (Blueprint $table) {
|
2021-01-08 09:05:32 +00:00
|
|
|
$table->id()->unique();
|
2021-01-08 09:03:19 +00:00
|
|
|
$table->int('room_id'); //TODO: Foregin key to Room Table
|
|
|
|
$table->string('owner_id'); //TODO: Foregin key to user Table
|
2021-01-08 09:08:21 +00:00
|
|
|
$table->string('token')->unique();
|
2021-01-08 09:03:19 +00:00
|
|
|
$table->boolval('approved');
|
2021-01-07 18:45:25 +00:00
|
|
|
$table->string('name')->unique();
|
|
|
|
$table->string('description')->nullable();
|
2021-01-08 09:08:21 +00:00
|
|
|
$table->string('type');
|
|
|
|
$table->string('icon');
|
|
|
|
$table->string('mac_address');
|
|
|
|
$table->string('ip_address')->unique();
|
|
|
|
$table->string('firmware_hash');
|
|
|
|
$table->string('sleep_time');
|
|
|
|
$table->datetime('heartbeat')
|
|
|
|
$table->string('command');
|
2021-01-07 18:45:25 +00:00
|
|
|
$table->timestamps();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('devices');
|
|
|
|
}
|
|
|
|
}
|