From ab7e1620444db90b7d9edb7f7e43611f835adbc7 Mon Sep 17 00:00:00 2001 From: Steve <34465153+xxl4@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:18:00 +0800 Subject: [PATCH] fix db file --- ...php => 2024_09_01_000000_create_rules_table.php} | 13 ++++++------- ... 2024_09_03_034032_create_permissions_table.php} | 7 +++---- ...php => 2024_09_06_025419_create_roles_table.php} | 3 +-- 3 files changed, 10 insertions(+), 13 deletions(-) rename src/Database/Migrations/{2019_03_01_000000_create_rules_table.php => 2024_09_01_000000_create_rules_table.php} (56%) rename src/Database/Migrations/{2022_12_03_034032_create_permissions_table.php => 2024_09_03_034032_create_permissions_table.php} (86%) rename src/Database/Migrations/{2022_12_12_025419_create_roles_table.php => 2024_09_06_025419_create_roles_table.php} (86%) diff --git a/src/Database/Migrations/2019_03_01_000000_create_rules_table.php b/src/Database/Migrations/2024_09_01_000000_create_rules_table.php similarity index 56% rename from src/Database/Migrations/2019_03_01_000000_create_rules_table.php rename to src/Database/Migrations/2024_09_01_000000_create_rules_table.php index 6bdd9fe..f854671 100644 --- a/src/Database/Migrations/2019_03_01_000000_create_rules_table.php +++ b/src/Database/Migrations/2024_09_01_000000_create_rules_table.php @@ -11,8 +11,8 @@ class CreateRulesTable extends Migration */ public function up() { - $connection = config('lauthz.basic.database.connection') ?: config('database.default'); - Schema::connection($connection)->create(config('lauthz.basic.database.rules_table'), function (Blueprint $table) { + + Schema::create('rules', function (Blueprint $table) { $table->increments('id'); $table->string('ptype')->nullable(); $table->string('v0')->nullable(); @@ -21,9 +21,8 @@ public function up() $table->string('v3')->nullable(); $table->string('v4')->nullable(); $table->string('v5')->nullable(); - // $table->timestamps(); - $table->dateTime('created_at')->nullable(); - $table->dateTime('updated_at')->nullable(); + $table->timestamps(); + }); } @@ -32,7 +31,7 @@ public function up() */ public function down() { - $connection = config('lauthz.basic.database.connection') ?: config('database.default'); - Schema::connection($connection)->dropIfExists(config('lauthz.basic.database.rules_table')); + + Schema::dropIfExists('rules'); } } diff --git a/src/Database/Migrations/2022_12_03_034032_create_permissions_table.php b/src/Database/Migrations/2024_09_03_034032_create_permissions_table.php similarity index 86% rename from src/Database/Migrations/2022_12_03_034032_create_permissions_table.php rename to src/Database/Migrations/2024_09_03_034032_create_permissions_table.php index 3cd0bf9..fc4de73 100644 --- a/src/Database/Migrations/2022_12_03_034032_create_permissions_table.php +++ b/src/Database/Migrations/2024_09_03_034032_create_permissions_table.php @@ -15,8 +15,8 @@ public function up() { Schema::create('permissions', function (Blueprint $table) { $table->increments('id'); - $table->string('title'); - $table->string('path')->nullable(); + $table->string('title')->comment('permission title'); + $table->string('path')->comment('permission path')->nullable(); $table->string('name')->nullable(); $table->string('redirect')->nullable(); $table->string('icon')->nullable(); @@ -29,8 +29,7 @@ public function up() $table->unsignedTinyInteger('sort')->default(0); $table->unsignedTinyInteger('type')->default(0); $table->unsignedTinyInteger('status')->default(1); - $table->dateTime('created_at')->nullable(); - $table->dateTime('updated_at')->nullable(); + $table->timestamps(); }); } diff --git a/src/Database/Migrations/2022_12_12_025419_create_roles_table.php b/src/Database/Migrations/2024_09_06_025419_create_roles_table.php similarity index 86% rename from src/Database/Migrations/2022_12_12_025419_create_roles_table.php rename to src/Database/Migrations/2024_09_06_025419_create_roles_table.php index a4ae6c5..b059f04 100644 --- a/src/Database/Migrations/2022_12_12_025419_create_roles_table.php +++ b/src/Database/Migrations/2024_09_06_025419_create_roles_table.php @@ -19,8 +19,7 @@ public function up() $table->string('value')->unique(); $table->string('desc')->nullable(); $table->unsignedTinyInteger('status')->default(1); - $table->dateTime('created_at')->nullable(); - $table->dateTime('updated_at')->nullable(); + $table->timestamps(); }); }