Explorar el Código

fix: migration

Muhammad Iqbal Afandi hace 3 años
padre
commit
0ac9253f80

+ 1
- 1
database/migrations/2022_04_20_031728_create_members_table.php Ver fichero

17
             $table->id();
17
             $table->id();
18
             $table->string('name');
18
             $table->string('name');
19
             $table->string('phone')->unique();
19
             $table->string('phone')->unique();
20
-            $table->string('plat_number')->unique();
20
+            $table->dateTime('exp_date');
21
             $table->foreignId('type_member_id')->constrained();
21
             $table->foreignId('type_member_id')->constrained();
22
             $table->timestamps();
22
             $table->timestamps();
23
         });
23
         });

+ 1
- 1
database/migrations/2022_04_20_031728_create_top_ups_table.php Ver fichero

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

+ 33
- 0
database/migrations/2022_04_23_122416_create_transaction_ins_table.php Ver fichero

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 Ver fichero

13
      */
13
      */
14
     public function up()
14
     public function up()
15
     {
15
     {
16
-        Schema::create('transactions', function (Blueprint $table) {
16
+        Schema::create('transaction_outs', function (Blueprint $table) {
17
             $table->id();
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
             $table->foreignId('type_vehicle_id')->constrained();
20
             $table->foreignId('type_vehicle_id')->constrained();
25
             $table->foreignId('user_id')->constrained();
21
             $table->foreignId('user_id')->constrained();
26
-            $table->foreignId('member_id')->nullable()->default(null)->constrained();
27
             $table->timestamps();
22
             $table->timestamps();
28
         });
23
         });
29
     }
24
     }
35
      */
30
      */
36
     public function down()
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 Ver fichero

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 Ver fichero

17
             $table->id();
17
             $table->id();
18
             $table->string('type');
18
             $table->string('type');
19
             $table->unsignedInteger('amount');
19
             $table->unsignedInteger('amount');
20
-            $table->foreignId('transaction_id')->nullable()->default(null)->constrained();
20
+            $table->foreignId('transaction_out')->nullable()->default(null)->constrained();
21
             $table->foreignId('expense_id')->nullable()->default(null)->constrained();
21
             $table->foreignId('expense_id')->nullable()->default(null)->constrained();
22
             $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
22
             $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
23
             $table->timestamps();
23
             $table->timestamps();

+ 50
- 36
designs/diagrams/database.puml Ver fichero

1
 @startuml Database
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
 entity User {
20
 entity User {
4
   * id
21
   * id
5
   __
22
   __
17
   * name
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
 entity TypeVehicle {
37
 entity TypeVehicle {
30
   * id
38
   * id
31
   __
39
   __
40
   * type_vehicle_id
48
   * type_vehicle_id
41
 }
49
 }
42
 
50
 
43
-entity Transaction {
51
+entity Member {
44
   * id
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
   * id
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
   * id
70
   * id
67
   __
71
   __
68
   * type
72
   * type
69
-  * amount
70
-  transaction_id
71
-  expense_id
72
-  topup_id
73
+  * price
73
 }
74
 }
74
 
75
 
75
 entity TopUp {
76
 entity TopUp {
76
   * id
77
   * id
77
   __
78
   __
78
-  * balance
79
+  * amount
79
   * exp_date
80
   * exp_date
80
   * member_id
81
   * member_id
81
   * user_id
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
   * id
94
   * id
86
   __
95
   __
87
   * type
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
 TypeVehicle }|--|| ParkingFee
108
 TypeVehicle }|--|| ParkingFee
96
 Expense ||--|| Mutation
109
 Expense ||--|| Mutation
97
 TopUp ||--|| Mutation
110
 TopUp ||--|| Mutation
99
 User }|--|| TopUp
112
 User }|--|| TopUp
100
 User }|--|| Expense
113
 User }|--|| Expense
101
 Member }|--|| TopUp
114
 Member }|--|| TopUp
102
-Member ||--|| TypeMember
115
+Member }|--|| TypeMember
116
+Member }|--|| Vehicle

BIN
designs/diagrams/database/Database.png Ver fichero