浏览代码

add auth migrations

Yong 2 年前
父节点
当前提交
7eea8b264d

+ 6
- 15
database/migrations/2014_10_12_000000_create_users_table.php 查看文件

@@ -1,36 +1,27 @@
1 1
 <?php
2 2
 
3
-use Illuminate\Database\Migrations\Migration;
4
-use Illuminate\Database\Schema\Blueprint;
5 3
 use Illuminate\Support\Facades\Schema;
4
+use Illuminate\Database\Schema\Blueprint;
5
+use Illuminate\Database\Migrations\Migration;
6 6
 
7 7
 class CreateUsersTable extends Migration
8 8
 {
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
9
+    private $tableName = 'users';
10
+
14 11
     public function up()
15 12
     {
16
-        Schema::create('users', function (Blueprint $table) {
13
+        Schema::create($this->tableName, function (Blueprint $table) {
17 14
             $table->id();
18 15
             $table->string('name');
19 16
             $table->string('email')->unique();
20
-            $table->timestamp('email_verified_at')->nullable();
21 17
             $table->string('password');
22 18
             $table->rememberToken();
23 19
             $table->timestamps();
24 20
         });
25 21
     }
26 22
 
27
-    /**
28
-     * Reverse the migrations.
29
-     *
30
-     * @return void
31
-     */
32 23
     public function down()
33 24
     {
34
-        Schema::dropIfExists('users');
25
+        Schema::dropIfExists($this->tableName);
35 26
     }
36 27
 }

+ 0
- 32
database/migrations/2014_10_12_100000_create_password_resets_table.php 查看文件

@@ -1,32 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Migrations\Migration;
4
-use Illuminate\Database\Schema\Blueprint;
5
-use Illuminate\Support\Facades\Schema;
6
-
7
-class CreatePasswordResetsTable extends Migration
8
-{
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        Schema::create('password_resets', function (Blueprint $table) {
17
-            $table->string('email')->index();
18
-            $table->string('token');
19
-            $table->timestamp('created_at')->nullable();
20
-        });
21
-    }
22
-
23
-    /**
24
-     * Reverse the migrations.
25
-     *
26
-     * @return void
27
-     */
28
-    public function down()
29
-    {
30
-        Schema::dropIfExists('password_resets');
31
-    }
32
-}

+ 27
- 0
database/migrations/2016_02_23_075631_create_functions_table.php 查看文件

@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateFunctionsTable extends Migration
7
+{
8
+    private $tableName = 'functions';
9
+
10
+    public function up()
11
+    {
12
+        Schema::create($this->tableName, function (Blueprint $table) {
13
+            $table->increments('id');
14
+            $table->string('FunName', 128);
15
+            $table->string('FunLink', 128);
16
+            $table->string('FunDesc', 128);
17
+            $table->unsignedTinyInteger('Valid');
18
+            $table->unsignedTinyInteger('Oid'); // TODO: 不知道作用
19
+            $table->timestamps();
20
+        });
21
+    }
22
+
23
+    public function down()
24
+    {
25
+        Schema::drop($this->tableName);
26
+    }
27
+}

+ 27
- 0
database/migrations/2016_02_23_080148_create_funmenu_table.php 查看文件

@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateFunmenuTable extends Migration
7
+{
8
+    private $tableName = 'funmenu';
9
+
10
+    public function up()
11
+    {
12
+        Schema::create($this->tableName, function (Blueprint $table) {
13
+            $table->increments('id');
14
+            $table->string('MenuName', 128);
15
+            $table->unsignedTinyInteger('Valid');
16
+            $table->integer('Corder');
17
+            $table->unsignedTinyInteger('Oid'); // TODO: 不知道作用
18
+            $table->string('icon', 128)->nullable();
19
+            $table->timestamps();
20
+        });
21
+    }
22
+
23
+    public function down()
24
+    {
25
+        Schema::drop($this->tableName);
26
+    }
27
+}

+ 27
- 0
database/migrations/2016_02_23_080344_create_funmenudetail_table.php 查看文件

@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateFunmenudetailTable extends Migration
7
+{
8
+    private $tableName = 'funmenudetail';
9
+
10
+    public function up()
11
+    {
12
+        Schema::create($this->tableName, function (Blueprint $table) {
13
+            $table->increments('id');
14
+            $table->unsignedTinyInteger('FunMenuId');
15
+            $table->unsignedTinyInteger('FunId');
16
+            $table->unsignedTinyInteger('Valid');
17
+            $table->unsignedTinyInteger('Corder');
18
+            $table->unsignedTinyInteger('Oid'); // TODO: 不知道作用
19
+            $table->timestamps();
20
+        });
21
+    }
22
+
23
+    public function down()
24
+    {
25
+        Schema::drop($this->tableName);
26
+    }
27
+}

+ 27
- 0
database/migrations/2016_02_23_080520_create_funusergroups_table.php 查看文件

@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateFunusergroupsTable extends Migration
7
+{
8
+    private $tableName = 'funusergroups';
9
+
10
+    public function up()
11
+    {
12
+        Schema::create($this->tableName, function (Blueprint $table) {
13
+            $table->increments('id');
14
+            $table->string('Name', 128);
15
+            $table->string('FunList', 256);
16
+            $table->string('UsrList', 256);
17
+            $table->unsignedTinyInteger('Valid');
18
+            $table->unsignedTinyInteger('Oid'); // TODO: 不知道作用
19
+            $table->timestamps();
20
+        });
21
+    }
22
+
23
+    public function down()
24
+    {
25
+        Schema::drop($this->tableName);
26
+    }
27
+}

+ 0
- 36
database/migrations/2019_08_19_000000_create_failed_jobs_table.php 查看文件

@@ -1,36 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Migrations\Migration;
4
-use Illuminate\Database\Schema\Blueprint;
5
-use Illuminate\Support\Facades\Schema;
6
-
7
-class CreateFailedJobsTable extends Migration
8
-{
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        Schema::create('failed_jobs', function (Blueprint $table) {
17
-            $table->id();
18
-            $table->string('uuid')->unique();
19
-            $table->text('connection');
20
-            $table->text('queue');
21
-            $table->longText('payload');
22
-            $table->longText('exception');
23
-            $table->timestamp('failed_at')->useCurrent();
24
-        });
25
-    }
26
-
27
-    /**
28
-     * Reverse the migrations.
29
-     *
30
-     * @return void
31
-     */
32
-    public function down()
33
-    {
34
-        Schema::dropIfExists('failed_jobs');
35
-    }
36
-}

+ 0
- 36
database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php 查看文件

@@ -1,36 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Migrations\Migration;
4
-use Illuminate\Database\Schema\Blueprint;
5
-use Illuminate\Support\Facades\Schema;
6
-
7
-class CreatePersonalAccessTokensTable extends Migration
8
-{
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        Schema::create('personal_access_tokens', function (Blueprint $table) {
17
-            $table->id();
18
-            $table->morphs('tokenable');
19
-            $table->string('name');
20
-            $table->string('token', 64)->unique();
21
-            $table->text('abilities')->nullable();
22
-            $table->timestamp('last_used_at')->nullable();
23
-            $table->timestamps();
24
-        });
25
-    }
26
-
27
-    /**
28
-     * Reverse the migrations.
29
-     *
30
-     * @return void
31
-     */
32
-    public function down()
33
-    {
34
-        Schema::dropIfExists('personal_access_tokens');
35
-    }
36
-}

+ 54
- 0
database/migrations/2022_06_29_180448_create_vLeftmenu_view.php 查看文件

@@ -0,0 +1,54 @@
1
+<?php
2
+
3
+use Illuminate\Support\Facades\DB;
4
+use Illuminate\Database\Schema\Blueprint;
5
+use Illuminate\Database\Migrations\Migration;
6
+
7
+class CreateVLeftmenuView extends Migration
8
+{
9
+    public function up()
10
+    {
11
+        DB::statement("CREATE VIEW `v_leftmenu` AS
12
+            SELECT 
13
+                `funmenu`.`icon` AS `icon`,
14
+                `funmenu`.`MenuName` AS `MenuName`,
15
+                `funmenu`.`Corder` AS `FunMenuCorder`,
16
+                `funmenudetail`.`FunMenuId` AS `FunMenuId`,
17
+                `funmenudetail`.`FunId` AS `FunId`,
18
+                `functions`.`FunName` AS `FunName`,
19
+                `functions`.`FunLink` AS `FunLink`,
20
+                `functions`.`FunDesc` AS `FunDesc`,
21
+                `functions`.`Valid` AS `Valid`,
22
+                `functions`.`created_at` AS `created_at`,
23
+                `functions`.`updated_at` AS `updated_at`,
24
+                `functions`.`Oid` AS `Oid`,
25
+                `funmenudetail`.`Corder` AS FunMenuDetailCOrder
26
+            FROM
27
+                ((`funmenu`
28
+                JOIN funmenudetail ON ((`funmenu`.`id` = `funmenudetail`.`FunMenuId`)))
29
+                JOIN functions ON ((`funmenudetail`.`FunId` = `functions`.`id`)))
30
+            WHERE
31
+                `functions`.`id` IN (SELECT 
32
+                        `Functions_1`.`id`
33
+                    FROM
34
+                        functions Functions_1
35
+                    WHERE
36
+                        (LOCATE((CONVERT( CONCAT(',', `Functions_1`.`id`, ',') USING UTF8MB3) COLLATE utf8_unicode_ci),
37
+                                CONVERT( CONCAT(',',
38
+                                        (SELECT 
39
+                                                `funusergroups`.`FunList`
40
+                                            FROM
41
+                                                funusergroups
42
+                                            WHERE
43
+                                                (`funusergroups`.`id` = 1)),
44
+                                        ',') USING UTF8MB3)) > 0))
45
+            ORDER BY `funmenu`.`Corder` , `funmenudetail`.`Corder`
46
+            LIMIT 0 , 1000
47
+        ");
48
+    }
49
+
50
+    public function down()
51
+    {
52
+        DB::statement("DROP VIEW v_leftmenu");
53
+    }
54
+}