This commit is contained in:
Romano Schoonheim 2021-01-10 10:37:00 -08:00
commit c608b34de4
3 changed files with 24 additions and 2 deletions

5
.gitignore vendored
View File

@ -12,3 +12,8 @@ Homestead.yaml
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
.idea/ .idea/
.vscode

View File

@ -14,9 +14,12 @@ class CreateRoomsTable extends Migration
public function up() public function up()
{ {
Schema::create('rooms', function (Blueprint $table) { Schema::create('rooms', function (Blueprint $table) {
$table->id(); $table->id()->unique();
$table->string('name')->unique(); $table->string('name')->unique();
$table->int('owner_id'); //TODO: Foregin key to user Table
$table->boolval('default');
$table->timestamps(); $table->timestamps();
$table->forgein('owner_id')->references('user_id')->on('users');
}); });
} }

View File

@ -14,9 +14,23 @@ class CreateDevicesTable extends Migration
public function up() public function up()
{ {
Schema::create('devices', function (Blueprint $table) { 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('name')->unique();
$table->string('description')->nullable(); $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(); $table->timestamps();
}); });
} }