浏览代码

默认表格

jqh 4 年之前
父节点
当前提交
fc85371b7a

+ 2 - 2
database/migrations/2020_09_07_090635_create_admin_settings_table.php

@@ -23,7 +23,7 @@ class CreateAdminSettingsTable extends Migration
      */
     public function up()
     {
-        Schema::create($this->config('database.settings_table'), function (Blueprint $table) {
+        Schema::create($this->config('database.settings_table') ?: 'admin_settings', function (Blueprint $table) {
             $table->string('slug', 100)->primary();
             $table->longText('value');
             $table->timestamps();
@@ -37,6 +37,6 @@ class CreateAdminSettingsTable extends Migration
      */
     public function down()
     {
-        Schema::dropIfExists($this->config('database.settings_table'));
+        Schema::dropIfExists($this->config('database.settings_table') ?: 'admin_settings');
     }
 }

+ 4 - 4
database/migrations/2020_09_22_015815_create_admin_extensions_table.php

@@ -23,7 +23,7 @@ class CreateAdminExtensionsTable extends Migration
      */
     public function up()
     {
-        Schema::create($this->config('database.extensions_table'), function (Blueprint $table) {
+        Schema::create($this->config('database.extensions_table') ?: 'admin_extensions', function (Blueprint $table) {
             $table->increments('id')->unsigned();
             $table->string('name', 100)->unique();
             $table->string('version', 20)->default('');
@@ -34,7 +34,7 @@ class CreateAdminExtensionsTable extends Migration
             $table->engine = 'InnoDB';
         });
 
-        Schema::create($this->config('database.extension_histories_table'), function (Blueprint $table) {
+        Schema::create($this->config('database.extension_histories_table') ?: 'admin_extension_histories', function (Blueprint $table) {
             $table->bigIncrements('id')->unsigned();
             $table->string('name', 100);
             $table->tinyInteger('type')->default(1);
@@ -55,7 +55,7 @@ class CreateAdminExtensionsTable extends Migration
      */
     public function down()
     {
-        Schema::dropIfExists($this->config('database.extensions_table'));
-        Schema::dropIfExists($this->config('database.extension_histories_table'));
+        Schema::dropIfExists($this->config('database.extensions_table') ?: 'admin_extensions');
+        Schema::dropIfExists($this->config('database.extension_histories_table') ?: 'admin_extension_histories');
     }
 }

+ 1 - 1
src/Models/Extension.php

@@ -18,7 +18,7 @@ class Extension extends Model
 
         $this->setConnection($connection);
 
-        $this->setTable(config('admin.database.extensions_table'));
+        $this->setTable(config('admin.database.extensions_table') ?: 'admin_extensions');
 
         parent::__construct($attributes);
     }

+ 1 - 1
src/Models/ExtensionHistory.php

@@ -14,7 +14,7 @@ class ExtensionHistory extends Model
 
         $this->setConnection($connection);
 
-        $this->setTable(config('admin.database.extension_histories_table'));
+        $this->setTable(config('admin.database.extension_histories_table') ?: 'admin_extension_histories');
 
         parent::__construct($attributes);
     }

+ 1 - 1
src/Models/Setting.php

@@ -16,7 +16,7 @@ class Setting extends Model
 
         $this->setConnection($connection);
 
-        $this->setTable(config('admin.database.settings_table'));
+        $this->setTable(config('admin.database.settings_table') ?: 'admin_settings');
 
         parent::__construct($attributes);
     }