Browse Source

Foregin Keys

3.0^2
GamerClassN7 1 year ago
parent
commit
e38421ca2f
2 changed files with 4 additions and 1 deletions
  1. +1
    -0
      database/migrations/2021_01_07_183923_create_rooms_table.php
  2. +3
    -1
      database/migrations/2021_01_07_184250_create_devices_table.php

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

@ -19,6 +19,7 @@ class CreateRoomsTable extends Migration
$table->int('owner_id'); //TODO: Foregin key to user Table
$table->boolval('default');
$table->timestamps();
$table->forgein('owner_id')->references('user_id')->on('users');
});
}

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

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