Foregin Keys

This commit is contained in:
GamerClassN7 2021-01-10 19:30:45 +01:00
parent 27e9ef9f27
commit e38421ca2f
2 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,7 @@ class CreateRoomsTable extends Migration
$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');
$table->timestamps(); $table->timestamps();
$table->forgein('owner_id')->references('user_id')->on('users');
}); });
} }

View File

@ -27,8 +27,10 @@ class CreateDevicesTable extends Migration
$table->string('ip_address')->unique(); $table->string('ip_address')->unique();
$table->string('firmware_hash'); $table->string('firmware_hash');
$table->string('sleep_time'); $table->string('sleep_time');
$table->datetime('heartbeat') $table->datetime('heartbeat');
$table->string('command'); $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();
}); });
} }