Romano Schoonheim 1 year ago
parent
commit
c608b34de4
3 changed files with 24 additions and 2 deletions
  1. +5
    -0
      .gitignore
  2. +4
    -1
      database/migrations/2021_01_07_183923_create_rooms_table.php
  3. +15
    -1
      database/migrations/2021_01_07_184250_create_devices_table.php

+ 5
- 0
.gitignore View File

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

+ 4
- 1
database/migrations/2021_01_07_183923_create_rooms_table.php View File

@ -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');
});
}

+ 15
- 1
database/migrations/2021_01_07_184250_create_devices_table.php View File

@ -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();
});
}

Loading…
Cancel
Save