68 lines
1.8 KiB
PHP
68 lines
1.8 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
class CreateDashboardsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('dashboards', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->integer('company_id');
|
|
$table->integer('user_id');
|
|
$table->string('name');
|
|
$table->boolean('enabled')->default(1);
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index(['company_id']);
|
|
});
|
|
|
|
Schema::create('dashboard_widgets', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->integer('company_id');
|
|
$table->integer('user_id');
|
|
$table->integer('dashboard_id');
|
|
$table->integer('widget_id');
|
|
$table->string('name');
|
|
$table->text('settings')->nullable();
|
|
$table->integer('sort')->default(0);
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index(['company_id']);
|
|
});
|
|
|
|
Schema::create('widgets', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->integer('company_id');
|
|
$table->string('name');
|
|
$table->string('alias');
|
|
$table->text('settings')->nullable();
|
|
$table->boolean('enabled')->default(1);
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index(['company_id', 'alias']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::drop('dashboards');
|
|
Schema::drop('dashboard_widgets');
|
|
Schema::drop('widgets');
|
|
}
|
|
}
|