Bladeren bron

fix: migration

Muhammad Iqbal Afandi 3 jaren geleden
bovenliggende
commit
0d8939b9a3

+ 17
- 0
app/Models/MaxVehicle.php Bestand weergeven

@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+namespace App\Models;
4
+
5
+use Illuminate\Database\Eloquent\Factories\HasFactory;
6
+use Illuminate\Database\Eloquent\Model;
7
+
8
+class MaxVehicle extends Model
9
+{
10
+    use HasFactory;
11
+
12
+    protected $fillable = [
13
+        'max',
14
+        'member_id',
15
+        'type_vehicle_id',
16
+    ];
17
+}

+ 0
- 1
app/Models/TypeMember.php Bestand weergeven

@@ -16,7 +16,6 @@ class TypeMember extends Model
16 16
         'type',
17 17
         'description',
18 18
         'price',
19
-        'max',
20 19
     ];
21 20
 
22 21
     protected function updatedAt(): Attribute

+ 0
- 1
database/migrations/2022_04_20_031727_create_type_members_table.php Bestand weergeven

@@ -18,7 +18,6 @@ return new class extends Migration
18 18
             $table->string('type');
19 19
             $table->text('description');
20 20
             $table->unsignedInteger('price');
21
-            $table->unsignedInteger('max');
22 21
             $table->timestamps();
23 22
         });
24 23
     }

+ 1
- 1
database/migrations/2022_04_20_031728_create_top_ups_table.php Bestand weergeven

@@ -17,7 +17,7 @@ return new class extends Migration
17 17
             $table->id();
18 18
             $table->unsignedInteger('amount');
19 19
             $table->dateTime('exp_date');
20
-            $table->foreignId('member_id')->constrained()->cascadeOnDelete();
20
+            $table->foreignId('member_id')->constrained();
21 21
             $table->foreignId('user_id')->constrained();
22 22
             $table->timestamps();
23 23
         });

+ 1
- 0
database/migrations/2022_04_23_122428_create_transaction_outs_table.php Bestand weergeven

@@ -16,6 +16,7 @@ return new class extends Migration
16 16
         Schema::create('transaction_outs', function (Blueprint $table) {
17 17
             $table->id();
18 18
             $table->string('plat_number');
19
+            $table->unsignedInteger('price');
19 20
             $table->foreignId('transaction_in_id')->constrained();
20 21
             $table->foreignId('type_vehicle_id')->constrained();
21 22
             $table->foreignId('user_id')->constrained();

+ 1
- 1
database/migrations/2022_04_23_130215_create_vehicles_table.php Bestand weergeven

@@ -16,7 +16,7 @@ return new class extends Migration
16 16
         Schema::create('vehicles', function (Blueprint $table) {
17 17
             $table->id();
18 18
             $table->string('plat_number');
19
-            $table->foreignId('member_id')->constrained()->cascadeOnDelete();
19
+            $table->foreignId('member_id')->constrained();
20 20
             $table->foreignId('type_vehicle_id')->constrained();
21 21
             $table->timestamps();
22 22
         });

+ 1
- 1
database/migrations/2022_04_23_130216_create_mutations_table.php Bestand weergeven

@@ -19,7 +19,7 @@ return new class extends Migration
19 19
             $table->unsignedInteger('amount');
20 20
             $table->foreignId('transaction_out')->nullable()->default(null)->constrained();
21 21
             $table->foreignId('expense_id')->nullable()->default(null)->constrained();
22
-            $table->foreignId('top_up_id')->nullable()->default(null)->constrained()->cascadeOnDelete();
22
+            $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
23 23
             $table->timestamps();
24 24
         });
25 25
     }

+ 34
- 0
database/migrations/2022_04_28_111602_create_max_vehicles_table.php Bestand weergeven

@@ -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('max_vehicles', function (Blueprint $table) {
17
+            $table->id();
18
+            $table->unsignedInteger('max');
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('max_vehicles');
33
+    }
34
+};

+ 12
- 4
designs/diagrams/database.puml Bestand weergeven

@@ -65,14 +65,20 @@ entity Vehicle {
65 65
   * type_vehicle_id
66 66
 }
67 67
 
68
-
69 68
 entity TypeMember {
70 69
   * id
71 70
   __
72 71
   * type
73 72
   * description
74 73
   * price
74
+}
75
+
76
+entity MaxVehicle {
77
+  * id
78
+  __
75 79
   * max
80
+  * member_id
81
+  * type_vehicle_id
76 82
 }
77 83
 
78 84
 entity TopUp {
@@ -109,11 +115,13 @@ TransactionOut ||--|{ TypeVehicle
109 115
 TransactionOut ||--|{ User
110 116
 TypeVehicle ||--|| ParkingFee
111 117
 TypeVehicle }|--|| Vehicle
112
-Expense ||--|| Mutation
113
-TopUp ||--|| Mutation
118
+TypeVehicle }|--|| MaxVehicle
114 119
 User ||--|{ Role
115 120
 User }|--|| TopUp
116 121
 User }|--|| Expense
117 122
 Member }|--|| TopUp
118 123
 Member ||--|| TypeMember
119
-Member }|--|| Vehicle
124
+Member }|--|| Vehicle
125
+Expense ||--|| Mutation
126
+TypeMember }|--|| MaxVehicle
127
+TopUp ||--|| Mutation

BIN
designs/diagrams/database/Database.png Bestand weergeven