Migration Tweeks #1

This commit is contained in:
Václav Španinger 2021-01-08 10:05:32 +01:00
parent eb48d616a8
commit 7e5176d5f3
2 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ 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->int('owner_id'); //TODO: Foregin key to user Table
$table->boolval('default'); $table->boolval('default');

View File

@ -14,14 +14,14 @@ 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->int('room_id'); //TODO: Foregin key to Room Table
$table->string('type'); $table->string('type');
$table->string('token'); $table->string('token')->unique();
$table->datetime('heartbeat') $table->datetime('heartbeat')
$table->string('mac'); $table->string('mac');
$table->string('firmware_hash'); $table->string('firmware_hash');
$table->string('ip_address'); $table->string('ip_address')->unique();
$table->string('sleep_time'); $table->string('sleep_time');
$table->string('owner_id'); //TODO: Foregin key to user Table $table->string('owner_id'); //TODO: Foregin key to user Table
$table->boolval('approved'); $table->boolval('approved');