Parcourir la source

fix: migration

Muhammad Iqbal Afandi il y a 3 ans
Parent
révision
0ac9253f80

+ 1
- 1
database/migrations/2022_04_20_031728_create_members_table.php Voir le fichier

@@ -17,7 +17,7 @@ return new class extends Migration
17 17
             $table->id();
18 18
             $table->string('name');
19 19
             $table->string('phone')->unique();
20
-            $table->string('plat_number')->unique();
20
+            $table->dateTime('exp_date');
21 21
             $table->foreignId('type_member_id')->constrained();
22 22
             $table->timestamps();
23 23
         });

+ 1
- 1
database/migrations/2022_04_20_031728_create_top_ups_table.php Voir le fichier

@@ -15,7 +15,7 @@ return new class extends Migration
15 15
     {
16 16
         Schema::create('top_ups', function (Blueprint $table) {
17 17
             $table->id();
18
-            $table->unsignedInteger('balance');
18
+            $table->unsignedInteger('amount');
19 19
             $table->dateTime('exp_date');
20 20
             $table->foreignId('member_id')->constrained();
21 21
             $table->foreignId('user_id')->constrained();

+ 33
- 0
database/migrations/2022_04_23_122416_create_transaction_ins_table.php Voir le fichier

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

database/migrations/2022_04_20_031728_create_transactions_table.php → database/migrations/2022_04_23_122428_create_transaction_outs_table.php Voir le fichier

@@ -13,17 +13,12 @@ return new class extends Migration
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('transactions', function (Blueprint $table) {
16
+        Schema::create('transaction_outs', function (Blueprint $table) {
17 17
             $table->id();
18
-            $table->timestamp('login_time');
19
-            $table->dateTime('time_out');
20
-            $table->unsignedInteger('price');
21
-            $table->string('plat_number')->unique();
22
-            $table->string('input_by');
23
-            $table->string('capture_vehicle');
18
+            $table->string('plat_number');
19
+            $table->foreignId('transaction_in_id')->constrained();
24 20
             $table->foreignId('type_vehicle_id')->constrained();
25 21
             $table->foreignId('user_id')->constrained();
26
-            $table->foreignId('member_id')->nullable()->default(null)->constrained();
27 22
             $table->timestamps();
28 23
         });
29 24
     }
@@ -35,6 +30,6 @@ return new class extends Migration
35 30
      */
36 31
     public function down()
37 32
     {
38
-        Schema::dropIfExists('tansactions');
33
+        Schema::dropIfExists('transaction_outs');
39 34
     }
40 35
 };

+ 34
- 0
database/migrations/2022_04_23_130215_create_vehicles_table.php Voir le fichier

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

database/migrations/2022_04_20_031729_create_mutations_table.php → database/migrations/2022_04_23_130216_create_mutations_table.php Voir le fichier

@@ -17,7 +17,7 @@ return new class extends Migration
17 17
             $table->id();
18 18
             $table->string('type');
19 19
             $table->unsignedInteger('amount');
20
-            $table->foreignId('transaction_id')->nullable()->default(null)->constrained();
20
+            $table->foreignId('transaction_out')->nullable()->default(null)->constrained();
21 21
             $table->foreignId('expense_id')->nullable()->default(null)->constrained();
22 22
             $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
23 23
             $table->timestamps();

+ 50
- 36
designs/diagrams/database.puml Voir le fichier

@@ -1,5 +1,22 @@
1 1
 @startuml Database
2 2
 
3
+entity TransactionIn {
4
+  * id
5
+  __
6
+  * capture_vehicle
7
+  * transaction_number
8
+}
9
+
10
+entity TransactionOut {
11
+  * id
12
+  __
13
+  * plat_number
14
+  price
15
+  * transaction_in_id
16
+  type_vehicle_id
17
+  * user_id
18
+}
19
+
3 20
 entity User {
4 21
   * id
5 22
   __
@@ -17,15 +34,6 @@ entity Role {
17 34
   * name
18 35
 }
19 36
 
20
-entity Member {
21
-  * id
22
-  __
23
-  * name
24
-  * phone
25
-  * plat_number
26
-  * type_member_id
27
-}
28
-
29 37
 entity TypeVehicle {
30 38
   * id
31 39
   __
@@ -40,58 +48,63 @@ entity ParkingFee {
40 48
   * type_vehicle_id
41 49
 }
42 50
 
43
-entity Transaction {
51
+entity Member {
44 52
   * id
45 53
   __
46
-  * capture_vehicle
47
-  * transaction_number
48
-  * login_time
49
-  time_out
50
-  plat_number
51
-  price
52
-  type_vehicle_id
53
-  user_id
54
-  member_id
54
+  * name
55
+  * phone
56
+  * exp_date
57
+  * type_member_id
55 58
 }
56 59
 
57
-entity Expense {
60
+entity Vehicle {
58 61
   * id
59 62
   __
60
-  * description
61
-  * amount
62
-  * user_id
63
+  * plat_number
64
+  * member_id
65
+  * type_vehicle_id
63 66
 }
64 67
 
65
-entity Mutation {
68
+
69
+entity TypeMember {
66 70
   * id
67 71
   __
68 72
   * type
69
-  * amount
70
-  transaction_id
71
-  expense_id
72
-  topup_id
73
+  * price
73 74
 }
74 75
 
75 76
 entity TopUp {
76 77
   * id
77 78
   __
78
-  * balance
79
+  * amount
79 80
   * exp_date
80 81
   * member_id
81 82
   * user_id
82 83
 }
83 84
 
84
-entity TypeMember {
85
+entity Expense {
86
+  * id
87
+  __
88
+  * description
89
+  * amount
90
+  * user_id
91
+}
92
+
93
+entity Mutation {
85 94
   * id
86 95
   __
87 96
   * type
88
-  * price
97
+  * amount
98
+  transaction_out_id
99
+  expense_id
100
+  topup_id
89 101
 }
90 102
 
91
-Transaction ||--|{ Member
92
-Transaction ||--|{ TypeVehicle
93
-Transaction ||--|| Mutation
94
-Transaction ||--|{ User
103
+TransactionIn ||--|| TransactionOut
104
+TransactionOut ||--|| Mutation
105
+TransactionOut ||--|| Vehicle
106
+TransactionOut ||--|{ TypeVehicle
107
+TransactionOut ||--|{ User
95 108
 TypeVehicle }|--|| ParkingFee
96 109
 Expense ||--|| Mutation
97 110
 TopUp ||--|| Mutation
@@ -99,4 +112,5 @@ User ||--|{ Role
99 112
 User }|--|| TopUp
100 113
 User }|--|| Expense
101 114
 Member }|--|| TopUp
102
-Member ||--|| TypeMember
115
+Member }|--|| TypeMember
116
+Member }|--|| Vehicle

BIN
designs/diagrams/database/Database.png Voir le fichier