Browse Source

fix: migration

Muhammad Iqbal Afandi 3 years ago
parent
commit
0d8939b9a3

+ 17
- 0
app/Models/MaxVehicle.php View File

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 View File

16
         'type',
16
         'type',
17
         'description',
17
         'description',
18
         'price',
18
         'price',
19
-        'max',
20
     ];
19
     ];
21
 
20
 
22
     protected function updatedAt(): Attribute
21
     protected function updatedAt(): Attribute

+ 0
- 1
database/migrations/2022_04_20_031727_create_type_members_table.php View File

18
             $table->string('type');
18
             $table->string('type');
19
             $table->text('description');
19
             $table->text('description');
20
             $table->unsignedInteger('price');
20
             $table->unsignedInteger('price');
21
-            $table->unsignedInteger('max');
22
             $table->timestamps();
21
             $table->timestamps();
23
         });
22
         });
24
     }
23
     }

+ 1
- 1
database/migrations/2022_04_20_031728_create_top_ups_table.php View File

17
             $table->id();
17
             $table->id();
18
             $table->unsignedInteger('amount');
18
             $table->unsignedInteger('amount');
19
             $table->dateTime('exp_date');
19
             $table->dateTime('exp_date');
20
-            $table->foreignId('member_id')->constrained()->cascadeOnDelete();
20
+            $table->foreignId('member_id')->constrained();
21
             $table->foreignId('user_id')->constrained();
21
             $table->foreignId('user_id')->constrained();
22
             $table->timestamps();
22
             $table->timestamps();
23
         });
23
         });

+ 1
- 0
database/migrations/2022_04_23_122428_create_transaction_outs_table.php View File

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

+ 1
- 1
database/migrations/2022_04_23_130215_create_vehicles_table.php View File

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

+ 1
- 1
database/migrations/2022_04_23_130216_create_mutations_table.php View File

19
             $table->unsignedInteger('amount');
19
             $table->unsignedInteger('amount');
20
             $table->foreignId('transaction_out')->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()->cascadeOnDelete();
22
+            $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
23
             $table->timestamps();
23
             $table->timestamps();
24
         });
24
         });
25
     }
25
     }

+ 34
- 0
database/migrations/2022_04_28_111602_create_max_vehicles_table.php View File

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 View File

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

BIN
designs/diagrams/database/Database.png View File