mirror of
https://github.com/imperian-systems/unifi-controller.git
synced 2025-12-21 05:20:16 -06:00
Migration and model for UnifiSite
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UnifiDevicesAddAuthkeySiteFields extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('unifi_devices', function (Blueprint $table) {
|
||||
$table->string('auth_key')->default('ba86f2bbe107c7c57eb5f2690775c712');
|
||||
$table->string('site_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('unifi_devices', function (Blueprint $table) {
|
||||
$table->dropColumn('auth_key');
|
||||
$table->dropColumn('site_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUnifiSitesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('unifi_sites', function (Blueprint $table) {
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->string('id');
|
||||
$table->primary('id');
|
||||
$table->string('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('unifi_sites');
|
||||
}
|
||||
}
|
||||
15
src/Models/UnifiSite.php
Normal file
15
src/Models/UnifiSite.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace ImperianSystems\UnifiController\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UnifiSite extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $primaryKey = 'serial';
|
||||
public $incrementing = false;
|
||||
protected $keyType = "string";
|
||||
}
|
||||
Reference in New Issue
Block a user