diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 05fb5d9..9517aca 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -15,6 +15,12 @@ return new class extends Migration $table->id(); $table->string('name'); $table->string('email')->unique(); + $table->string('phone')->nullable(); + $table->text('address')->nullable(); + $table->unsignedBigInteger('division_id')->nullable(); + $table->enum('status', ['aktif', 'nonaktif'])->default('aktif'); + $table->text('inactive_reason')->nullable(); + $table->date('last_activity_date')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); diff --git a/database/migrations/2026_04_02_205139_create_divisions_table.php b/database/migrations/2026_04_02_205139_create_divisions_table.php new file mode 100644 index 0000000..874e2ad --- /dev/null +++ b/database/migrations/2026_04_02_205139_create_divisions_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('name'); + $table->text('description')->nullable(); + $table->timestamps(); + }); + + Schema::table('users', function (Blueprint $table) { + $table->foreign('division_id')->references('id')->on('divisions')->nullOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('divisions'); + } +}; diff --git a/database/migrations/2026_04_02_205140_create_activities_table.php b/database/migrations/2026_04_02_205140_create_activities_table.php new file mode 100644 index 0000000..9a6c566 --- /dev/null +++ b/database/migrations/2026_04_02_205140_create_activities_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('title'); + $table->text('description')->nullable(); + $table->date('start_date'); + $table->date('end_date'); + $table->foreignId('created_by')->constrained('users'); + $table->enum('status', ['draft', 'pending', 'approved', 'rejected'])->default('draft'); + $table->foreignId('approved_by')->nullable()->constrained('users'); + $table->timestamp('approved_at')->nullable(); + $table->timestamp('executed_at')->nullable(); + $table->text('execution_notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('activities'); + } +}; diff --git a/database/migrations/2026_04_02_205140_create_member_status_logs_table.php b/database/migrations/2026_04_02_205140_create_member_status_logs_table.php new file mode 100644 index 0000000..3b58c7c --- /dev/null +++ b/database/migrations/2026_04_02_205140_create_member_status_logs_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('member_id')->constrained('users')->cascadeOnDelete(); + $table->foreignId('changed_by')->constrained('users'); + $table->string('old_status'); + $table->string('new_status'); + $table->text('reason')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('member_status_logs'); + } +}; diff --git a/database/migrations/2026_04_02_205141_create_activity_logs_table.php b/database/migrations/2026_04_02_205141_create_activity_logs_table.php new file mode 100644 index 0000000..12d2e79 --- /dev/null +++ b/database/migrations/2026_04_02_205141_create_activity_logs_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); + $table->string('action'); + $table->string('model_type')->nullable(); + $table->unsignedBigInteger('model_id')->nullable(); + $table->text('description')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('activity_logs'); + } +}; diff --git a/database/migrations/2026_04_02_205141_create_activity_member_table.php b/database/migrations/2026_04_02_205141_create_activity_member_table.php new file mode 100644 index 0000000..0509c01 --- /dev/null +++ b/database/migrations/2026_04_02_205141_create_activity_member_table.php @@ -0,0 +1,22 @@ +foreignId('activity_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->primary(['activity_id', 'user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('activity_member'); + } +}; diff --git a/database/migrations/2026_04_02_205141_create_cash_categories_table.php b/database/migrations/2026_04_02_205141_create_cash_categories_table.php new file mode 100644 index 0000000..e52e660 --- /dev/null +++ b/database/migrations/2026_04_02_205141_create_cash_categories_table.php @@ -0,0 +1,22 @@ +id(); + $table->string('name'); // pemasukan / pengeluaran + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('cash_categories'); + } +}; diff --git a/database/migrations/2026_04_02_205141_create_cash_records_table.php b/database/migrations/2026_04_02_205141_create_cash_records_table.php new file mode 100644 index 0000000..8b81c72 --- /dev/null +++ b/database/migrations/2026_04_02_205141_create_cash_records_table.php @@ -0,0 +1,28 @@ +id(); + $table->bigInteger('amount'); + $table->foreignId('category_id')->constrained('cash_categories'); + $table->text('description'); + $table->date('date'); + $table->foreignId('created_by')->constrained('users'); + $table->foreignId('verified_by')->nullable()->constrained('users'); + $table->timestamp('verified_at')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('cash_records'); + } +}; diff --git a/database/migrations/2026_04_02_205142_create_approvals_table.php b/database/migrations/2026_04_02_205142_create_approvals_table.php new file mode 100644 index 0000000..0290c15 --- /dev/null +++ b/database/migrations/2026_04_02_205142_create_approvals_table.php @@ -0,0 +1,25 @@ +id(); + $table->string('model_type'); + $table->unsignedBigInteger('model_id'); + $table->unsignedTinyInteger('required_approvals')->default(1); + $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('approvals'); + } +}; diff --git a/database/migrations/2026_04_02_205142_create_votes_table.php b/database/migrations/2026_04_02_205142_create_votes_table.php new file mode 100644 index 0000000..7a73929 --- /dev/null +++ b/database/migrations/2026_04_02_205142_create_votes_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('title'); + $table->text('description')->nullable(); + $table->enum('type', ['activity', 'finance', 'general']); + $table->unsignedBigInteger('related_id')->nullable(); + $table->enum('status', ['open', 'closed'])->default('open'); + $table->timestamp('deadline')->nullable(); + $table->foreignId('created_by')->constrained('users'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('votes'); + } +}; diff --git a/database/migrations/2026_04_02_205143_create_vote_items_table.php b/database/migrations/2026_04_02_205143_create_vote_items_table.php new file mode 100644 index 0000000..1f9d232 --- /dev/null +++ b/database/migrations/2026_04_02_205143_create_vote_items_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('vote_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->enum('choice', ['approve', 'reject', 'abstain']); + $table->timestamps(); + $table->unique(['vote_id', 'user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('vote_items'); + } +}; diff --git a/database/migrations/2026_04_02_205144_create_approval_items_table.php b/database/migrations/2026_04_02_205144_create_approval_items_table.php new file mode 100644 index 0000000..ba4a3fa --- /dev/null +++ b/database/migrations/2026_04_02_205144_create_approval_items_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('approval_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->enum('decision', ['approve', 'reject']); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->unique(['approval_id', 'user_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('approval_items'); + } +}; diff --git a/database/migrations/2026_04_02_205144_create_audits_table.php b/database/migrations/2026_04_02_205144_create_audits_table.php new file mode 100644 index 0000000..2becb6a --- /dev/null +++ b/database/migrations/2026_04_02_205144_create_audits_table.php @@ -0,0 +1,27 @@ +id(); + $table->foreignId('auditor_id')->constrained('users'); + $table->string('model_type'); + $table->unsignedBigInteger('model_id'); + $table->enum('issue_type', ['warning', 'critical']); + $table->text('description'); + $table->enum('status', ['open', 'resolved'])->default('open'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('audits'); + } +}; diff --git a/database/migrations/2026_04_02_205145_create_audit_responses_table.php b/database/migrations/2026_04_02_205145_create_audit_responses_table.php new file mode 100644 index 0000000..ba238c4 --- /dev/null +++ b/database/migrations/2026_04_02_205145_create_audit_responses_table.php @@ -0,0 +1,24 @@ +id(); + $table->foreignId('audit_id')->constrained()->cascadeOnDelete(); + $table->foreignId('responded_by')->constrained('users'); + $table->text('response_text'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('audit_responses'); + } +};