This commit is contained in:
2023-01-11 11:00:43 +08:00
commit ff55141a1e
791 changed files with 177427 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminTables extends Migration
{
/**
* {@inheritdoc}
*/
public function getConnection()
{
return config('admin.database.connection') ?: config('database.default');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('admin.database.users_table'), function (Blueprint $table) {
$table->increments('id');
$table->string('username', 190)->unique();
$table->string('password', 60);
$table->string('name');
$table->string('avatar')->nullable();
$table->string('remember_token', 100)->nullable();
$table->timestamps();
});
Schema::create(config('admin.database.roles_table'), function (Blueprint $table) {
$table->increments('id');
$table->string('name', 50)->unique();
$table->string('slug', 50)->unique();
$table->timestamps();
});
Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) {
$table->increments('id');
$table->string('name', 50)->unique();
$table->string('slug', 50)->unique();
$table->string('http_method')->nullable();
$table->text('http_path')->nullable();
$table->timestamps();
});
Schema::create(config('admin.database.menu_table'), function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_id')->default(0);
$table->integer('order')->default(0);
$table->string('title', 50);
$table->string('icon', 50);
$table->string('uri')->nullable();
$table->string('permission')->nullable();
$table->timestamps();
});
Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) {
$table->integer('role_id');
$table->integer('user_id');
$table->index(['role_id', 'user_id']);
$table->timestamps();
});
Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) {
$table->integer('role_id');
$table->integer('permission_id');
$table->index(['role_id', 'permission_id']);
$table->timestamps();
});
Schema::create(config('admin.database.user_permissions_table'), function (Blueprint $table) {
$table->integer('user_id');
$table->integer('permission_id');
$table->index(['user_id', 'permission_id']);
$table->timestamps();
});
Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) {
$table->integer('role_id');
$table->integer('menu_id');
$table->index(['role_id', 'menu_id']);
$table->timestamps();
});
Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->string('path');
$table->string('method', 10);
$table->string('ip');
$table->text('input');
$table->index('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists(config('admin.database.users_table'));
Schema::dropIfExists(config('admin.database.roles_table'));
Schema::dropIfExists(config('admin.database.permissions_table'));
Schema::dropIfExists(config('admin.database.menu_table'));
Schema::dropIfExists(config('admin.database.user_permissions_table'));
Schema::dropIfExists(config('admin.database.role_users_table'));
Schema::dropIfExists(config('admin.database.role_permissions_table'));
Schema::dropIfExists(config('admin.database.role_menu_table'));
Schema::dropIfExists(config('admin.database.operation_log_table'));
}
}

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFavoritesTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create(config('favorite.favorites_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger(config('favorite.user_foreign_key'))->index()->comment('user_id');
$table->morphs('favoriteable');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists(config('favorite.favorites_table'));
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSubscriptionsTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create(config('subscribe.subscriptions_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger(config('subscribe.user_foreign_key'))->index()->comment('user_id');
$table->morphs('subscribable');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists(config('subscribe.subscriptions_table'));
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMaterialsTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('materials', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('cover');
$table->timestamps();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('materials');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBounsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bouns', function (Blueprint $table) {
$table->id();
$table->timestamp('date')->nullable()->comment('分红时间');
$table->string('type', 20)->comment('分红类别');
$table->unsignedDecimal('total', 12, 2)->default(0)->comment('分红累计金额');
$table->boolean('status')->default(0)->comment('分红状态');
$table->text('source')->nullable()->comment('数组源信息');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bouns');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBounsOrdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bouns_orders', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('bouns_id');
$table->morphs('order');
$table->string('type', 20)->comment('类别');
$table->unsignedDecimal('total', 12, 2)->default(0)->comment('订单金额');
$table->unsignedDecimal('amount', 12, 2)->default(0)->comment('产生分红');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bouns_orders');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBounsUserPervesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bouns_user_perves', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('user_id')->comment('用户ID');
$table->timestamp('date')->nullable()->comment('分红时间');
$table->unsignedInteger('star')->nullable()->comment('当时星级');
$table->unsignedDecimal('old_perf', 12, 2)->default(0)->comment('累计业绩');
$table->unsignedDecimal('new_perf', 12, 2)->default(0)->comment('新增业绩');
$table->unsignedDecimal('price', 12, 6)->nullable()->comment('单价');
$table->unsignedDecimal('amount', 12, 2)->nullable()->comment('应得');
$table->boolean('status')->default(0)->comment('状态');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bouns_user_perves');
}
}