Initial commit

This commit is contained in:
2026-04-12 06:24:30 +00:00
commit 007f107be6
213 changed files with 25576 additions and 0 deletions
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('academic_years', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->unique();
$table->unsignedSmallInteger('start_year');
$table->unsignedSmallInteger('end_year');
$table->boolean('is_active')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('academic_years');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('departments', function (Blueprint $table) {
$table->id();
$table->string('code', 20)->unique();
$table->string('name', 100);
$table->text('description')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('departments');
}
};
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('classes', function (Blueprint $table) {
$table->id();
$table->foreignId('academic_year_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('department_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->string('name', 100);
$table->string('level', 10);
$table->string('homeroom_teacher', 100)->nullable();
$table->unsignedInteger('capacity')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->unique(['academic_year_id', 'name']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('classes');
}
};
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('document_types', function (Blueprint $table) {
$table->id();
$table->string('code', 50)->unique();
$table->string('name', 100);
$table->text('description')->nullable();
$table->boolean('is_required')->default(false);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('document_types');
}
};
@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('students', function (Blueprint $table) {
$table->id();
$table->string('student_number', 30)->nullable()->unique();
$table->string('nisn', 30)->nullable()->unique();
$table->string('full_name', 150);
$table->enum('gender', ['L', 'P']);
$table->string('place_of_birth', 100)->nullable();
$table->date('date_of_birth')->nullable();
$table->string('religion', 50)->nullable();
$table->string('nationality', 50)->default('Indonesia');
$table->string('family_card_number', 30)->nullable();
$table->unsignedTinyInteger('child_order')->nullable();
$table->unsignedTinyInteger('number_of_siblings')->nullable();
$table->string('phone_number', 30)->nullable();
$table->string('email', 100)->nullable();
$table->text('address')->nullable();
$table->string('village', 100)->nullable();
$table->string('district', 100)->nullable();
$table->string('city', 100)->nullable();
$table->string('province', 100)->nullable();
$table->string('postal_code', 10)->nullable();
$table->foreignId('academic_year_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('department_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('class_id')->constrained('classes')->cascadeOnUpdate()->restrictOnDelete();
$table->date('entry_date')->nullable();
$table->enum('status', ['active', 'graduated', 'transferred', 'dropped', 'inactive'])->default('active');
$table->string('photo_path')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['academic_year_id', 'department_id', 'class_id']);
$table->index('status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('students');
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('student_parents', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->constrained()->cascadeOnUpdate()->cascadeOnDelete();
$table->enum('relation_type', ['father', 'mother', 'guardian']);
$table->string('name', 150);
$table->string('nik', 30)->nullable();
$table->unsignedSmallInteger('birth_year')->nullable();
$table->string('education', 100)->nullable();
$table->string('occupation', 100)->nullable();
$table->string('phone_number', 30)->nullable();
$table->text('address')->nullable();
$table->boolean('is_alive')->default(true);
$table->timestamps();
$table->unique(['student_id', 'relation_type']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('student_parents');
}
};
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('student_documents', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->constrained()->cascadeOnUpdate()->cascadeOnDelete();
$table->foreignId('document_type_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->string('file_name');
$table->string('file_path');
$table->string('file_extension', 20)->nullable();
$table->string('mime_type', 100)->nullable();
$table->unsignedBigInteger('file_size')->nullable();
$table->string('document_number', 100)->nullable();
$table->date('issued_date')->nullable();
$table->date('expired_date')->nullable();
$table->text('description')->nullable();
$table->enum('verification_status', ['pending', 'valid', 'invalid', 'revision'])->default('pending');
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('verified_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('verified_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['student_id', 'document_type_id']);
$table->index('verification_status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('student_documents');
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('document_types', function (Blueprint $table) {
$table->unsignedInteger('max_file_size_kb')->nullable()->after('description');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('document_types', function (Blueprint $table) {
$table->dropColumn('max_file_size_kb');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('document_types', function (Blueprint $table) {
$table->string('allowed_extensions', 255)->nullable()->after('max_file_size_kb');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('document_types', function (Blueprint $table) {
$table->dropColumn('allowed_extensions');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('student_documents', function (Blueprint $table) {
$table->text('verification_note')->nullable()->after('verification_status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('student_documents', function (Blueprint $table) {
$table->dropColumn('verification_note');
});
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('student_academic_histories', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->constrained()->cascadeOnUpdate()->cascadeOnDelete();
$table->foreignId('academic_year_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('department_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('class_id')->constrained('classes')->cascadeOnUpdate()->restrictOnDelete();
$table->string('status', 30)->default('active');
$table->date('start_date')->nullable();
$table->date('end_date')->nullable();
$table->text('notes')->nullable();
$table->boolean('is_current')->default(true);
$table->timestamps();
$table->index(['student_id', 'is_current']);
$table->unique(['student_id', 'academic_year_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('student_academic_histories');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('role', 30)->default('staff')->after('email');
});
DB::table('users')->update(['role' => 'admin']);
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('role');
});
}
};
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('student_exits', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->unique()->constrained('students')->cascadeOnUpdate()->cascadeOnDelete();
$table->string('student_number', 30)->nullable();
$table->string('nisn', 30)->nullable();
$table->string('full_name', 150);
$table->foreignId('academic_year_id')->nullable()->constrained()->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('class_id')->nullable()->constrained('classes')->nullOnDelete()->cascadeOnUpdate();
$table->date('entry_date')->nullable();
$table->date('exit_date')->nullable();
$table->text('exit_reason')->nullable();
$table->string('status', 30)->default('dropped');
$table->timestamps();
$table->index('status');
$table->index('exit_date');
});
}
public function down(): void
{
Schema::dropIfExists('student_exits');
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('student_exits', function (Blueprint $table) {
$table->string('exit_letter_file_name')->nullable()->after('exit_reason');
$table->string('exit_letter_file_path')->nullable()->after('exit_letter_file_name');
$table->string('exit_letter_mime_type')->nullable()->after('exit_letter_file_path');
$table->unsignedBigInteger('exit_letter_file_size')->nullable()->after('exit_letter_mime_type');
});
}
public function down(): void
{
Schema::table('student_exits', function (Blueprint $table) {
$table->dropColumn([
'exit_letter_file_name',
'exit_letter_file_path',
'exit_letter_mime_type',
'exit_letter_file_size',
]);
});
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('student_transfers', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->unique()->constrained('students')->cascadeOnUpdate()->cascadeOnDelete();
$table->string('student_number', 30)->nullable();
$table->string('nisn', 30)->nullable();
$table->string('full_name', 150);
$table->foreignId('academic_year_id')->nullable()->constrained()->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete()->cascadeOnUpdate();
$table->foreignId('class_id')->nullable()->constrained('classes')->nullOnDelete()->cascadeOnUpdate();
$table->date('entry_date')->nullable();
$table->date('transfer_date')->nullable();
$table->text('transfer_reason')->nullable();
$table->string('transfer_letter_file_name')->nullable();
$table->string('transfer_letter_file_path')->nullable();
$table->string('transfer_letter_mime_type')->nullable();
$table->unsignedBigInteger('transfer_letter_file_size')->nullable();
$table->string('status', 30)->default('transferred');
$table->timestamps();
$table->index('status');
$table->index('transfer_date');
});
}
public function down(): void
{
Schema::dropIfExists('student_transfers');
}
};
@@ -0,0 +1,75 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('provinces', function (Blueprint $table) {
$table->string('id', 20)->primary();
$table->string('name', 100);
$table->timestamps();
});
Schema::create('regencies', function (Blueprint $table) {
$table->string('id', 20)->primary();
$table->string('province_id', 20);
$table->string('name', 100);
$table->timestamps();
$table->foreign('province_id')->references('id')->on('provinces')->cascadeOnUpdate()->cascadeOnDelete();
$table->index('province_id');
});
Schema::create('districts', function (Blueprint $table) {
$table->string('id', 20)->primary();
$table->string('regency_id', 20);
$table->string('name', 100);
$table->timestamps();
$table->foreign('regency_id')->references('id')->on('regencies')->cascadeOnUpdate()->cascadeOnDelete();
$table->index('regency_id');
});
Schema::create('villages', function (Blueprint $table) {
$table->string('id', 20)->primary();
$table->string('district_id', 20);
$table->string('name', 100);
$table->timestamps();
$table->foreign('district_id')->references('id')->on('districts')->cascadeOnUpdate()->cascadeOnDelete();
$table->index('district_id');
});
Schema::table('students', function (Blueprint $table) {
$table->string('province_id', 20)->nullable()->after('address');
$table->string('regency_id', 20)->nullable()->after('province_id');
$table->string('district_id', 20)->nullable()->after('regency_id');
$table->string('village_id', 20)->nullable()->after('district_id');
$table->foreign('province_id')->references('id')->on('provinces')->nullOnDelete()->cascadeOnUpdate();
$table->foreign('regency_id')->references('id')->on('regencies')->nullOnDelete()->cascadeOnUpdate();
$table->foreign('district_id')->references('id')->on('districts')->nullOnDelete()->cascadeOnUpdate();
$table->foreign('village_id')->references('id')->on('villages')->nullOnDelete()->cascadeOnUpdate();
});
}
public function down(): void
{
Schema::table('students', function (Blueprint $table) {
$table->dropForeign(['province_id']);
$table->dropForeign(['regency_id']);
$table->dropForeign(['district_id']);
$table->dropForeign(['village_id']);
$table->dropColumn(['province_id', 'regency_id', 'district_id', 'village_id']);
});
Schema::dropIfExists('villages');
Schema::dropIfExists('districts');
Schema::dropIfExists('regencies');
Schema::dropIfExists('provinces');
}
};
@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('students', function (Blueprint $table) {
$table->enum('self_service_status', ['not_started', 'draft', 'submitted'])
->default('not_started')
->after('status');
$table->timestamp('self_service_last_access_at')
->nullable()
->after('self_service_status');
$table->timestamp('self_service_submitted_at')
->nullable()
->after('self_service_last_access_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('students', function (Blueprint $table) {
$table->dropColumn([
'self_service_status',
'self_service_last_access_at',
'self_service_submitted_at',
]);
});
}
};
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('students', function (Blueprint $table) {
$table->string('self_service_access_code', 20)
->nullable()
->after('self_service_submitted_at');
$table->timestamp('self_service_code_generated_at')
->nullable()
->after('self_service_access_code');
$table->index('self_service_access_code');
});
}
public function down(): void
{
Schema::table('students', function (Blueprint $table) {
$table->dropIndex(['self_service_access_code']);
$table->dropColumn([
'self_service_access_code',
'self_service_code_generated_at',
]);
});
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('app_settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->text('value')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('app_settings');
}
};