diff --git a/.gitignore b/.gitignore index c502328..c75494f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,8 @@ Homestead.yaml npm-debug.log yarn-error.log .idea/ + + + + +.vscode diff --git a/database/migrations/2021_01_07_183923_create_rooms_table.php b/database/migrations/2021_01_07_183923_create_rooms_table.php index 546fbfa..4231b1b 100644 --- a/database/migrations/2021_01_07_183923_create_rooms_table.php +++ b/database/migrations/2021_01_07_183923_create_rooms_table.php @@ -14,9 +14,12 @@ class CreateRoomsTable extends Migration public function up() { Schema::create('rooms', function (Blueprint $table) { - $table->id(); + $table->id()->unique(); $table->string('name')->unique(); + $table->int('owner_id'); //TODO: Foregin key to user Table + $table->boolval('default'); $table->timestamps(); + $table->forgein('owner_id')->references('user_id')->on('users'); }); } diff --git a/database/migrations/2021_01_07_184250_create_devices_table.php b/database/migrations/2021_01_07_184250_create_devices_table.php index e743c72..43e41d6 100644 --- a/database/migrations/2021_01_07_184250_create_devices_table.php +++ b/database/migrations/2021_01_07_184250_create_devices_table.php @@ -14,9 +14,23 @@ class CreateDevicesTable extends Migration public function up() { Schema::create('devices', function (Blueprint $table) { - $table->id(); + $table->id()->unique(); + $table->int('room_id'); //TODO: Foregin key to Room Table + $table->string('owner_id'); //TODO: Foregin key to user Table + $table->string('token')->unique(); + $table->boolval('approved'); $table->string('name')->unique(); $table->string('description')->nullable(); + $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'); + $table->forgein('owner_id')->references('user_id')->on('users'); + $table->forgein('room_id')->references('room_id')->on('rooms'); $table->timestamps(); }); }