inti project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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): void {
|
||||
$table->unique(['school_id', 'school_id_number'], 'students_school_identifier_unique');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('students', function (Blueprint $table): void {
|
||||
$table->dropUnique('students_school_identifier_unique');
|
||||
});
|
||||
}
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?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('finance_audit_logs', function (Blueprint $table): void {
|
||||
$table->id(); $table->unsignedBigInteger('school_id')->index(); $table->string('academic_year_id')->nullable()->index(); $table->string('term_id')->nullable()->index(); $table->unsignedBigInteger('actor_user_id')->index(); $table->json('actor_role_snapshot')->nullable(); $table->string('action')->index(); $table->string('entity_type')->index(); $table->string('entity_id')->index(); $table->json('before_json')->nullable(); $table->json('after_json')->nullable(); $table->string('reason', 1000)->nullable(); $table->string('request_id')->nullable()->index(); $table->string('ip_address')->nullable(); $table->text('user_agent')->nullable(); $table->string('idempotency_key')->nullable()->index(); $table->timestamps(); $table->index(['entity_type','entity_id']);
|
||||
});
|
||||
Schema::create('payment_files', function (Blueprint $table): void {
|
||||
$table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('payment_id')->index(); $table->string('file_type')->default('receipt'); $table->string('storage_disk'); $table->string('storage_path'); $table->string('original_name')->nullable(); $table->string('mime_type')->nullable(); $table->json('metadata')->nullable(); $table->timestamps(); $table->unique(['payment_id','file_type']);
|
||||
});
|
||||
Schema::create('finance_idempotency_keys', function (Blueprint $table): void {
|
||||
$table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('actor_user_id')->index(); $table->string('operation')->index(); $table->string('idempotency_key'); $table->string('payload_hash'); $table->string('result_entity_type')->nullable(); $table->string('result_entity_id')->nullable(); $table->timestamp('expires_at')->nullable()->index(); $table->timestamps(); $table->unique(['school_id','actor_user_id','operation','idempotency_key'], 'finance_idempotency_unique');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('finance_idempotency_keys'); Schema::dropIfExists('payment_files'); Schema::dropIfExists('finance_audit_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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
|
||||
{
|
||||
foreach (['payments','invoices'] as $tableName) {
|
||||
if (! Schema::hasTable($tableName)) { continue; }
|
||||
Schema::table($tableName, function (Blueprint $table) use ($tableName): void {
|
||||
if (Schema::hasColumn($tableName, 'school_id')) { $table->index('school_id'); }
|
||||
if (Schema::hasColumn($tableName, 'status')) { $table->index('status'); }
|
||||
});
|
||||
}
|
||||
}
|
||||
public function down(): void {}
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('attendance_sessions')) {
|
||||
Schema::create('attendance_sessions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('academic_year_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('term_id')->nullable()->index();
|
||||
$table->string('name');
|
||||
$table->string('session_type')->index();
|
||||
$table->dateTime('starts_at')->index();
|
||||
$table->dateTime('ends_at')->index();
|
||||
$table->string('timezone')->default('UTC');
|
||||
$table->string('status')->default('open')->index();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('attendance_records')) {
|
||||
Schema::create('attendance_records', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('attendance_session_id')->nullable()->index();
|
||||
$table->date('attendance_date')->index();
|
||||
$table->string('subject_type')->index();
|
||||
$table->unsignedBigInteger('subject_id')->index();
|
||||
$table->string('status')->index();
|
||||
$table->string('source')->default('system');
|
||||
$table->dateTime('first_seen_at')->nullable();
|
||||
$table->dateTime('last_seen_at')->nullable();
|
||||
$table->unsignedBigInteger('recorded_by_user_id')->nullable()->index();
|
||||
$table->text('override_reason')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['school_id', 'attendance_session_id', 'subject_type', 'subject_id'], 'att_records_school_session_subject_unique');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('attendance_badges')) {
|
||||
Schema::create('attendance_badges', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->string('badge_value');
|
||||
$table->string('badge_type')->nullable();
|
||||
$table->string('subject_type')->index();
|
||||
$table->unsignedBigInteger('subject_id')->index();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->boolean('active')->default(true)->index();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['school_id', 'badge_value']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_badges');
|
||||
Schema::dropIfExists('attendance_records');
|
||||
Schema::dropIfExists('attendance_sessions');
|
||||
}
|
||||
};
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('attendance_scan_logs')) {
|
||||
Schema::create('attendance_scan_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('attendance_record_id')->nullable()->index();
|
||||
$table->string('subject_type')->index();
|
||||
$table->unsignedBigInteger('subject_id')->index();
|
||||
$table->unsignedBigInteger('badge_id')->nullable()->index();
|
||||
$table->string('station_id')->nullable()->index();
|
||||
$table->string('scan_action');
|
||||
$table->string('scan_source');
|
||||
$table->dateTime('scanned_at')->index();
|
||||
$table->string('status_result');
|
||||
$table->unsignedBigInteger('duplicate_of_id')->nullable()->index();
|
||||
$table->json('raw_payload_json')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('attendance_audit_logs')) {
|
||||
Schema::create('attendance_audit_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('academic_year_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('term_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('actor_user_id')->nullable()->index();
|
||||
$table->string('actor_type')->default('user');
|
||||
$table->string('action')->index();
|
||||
$table->string('subject_type')->index();
|
||||
$table->unsignedBigInteger('subject_id')->index();
|
||||
$table->unsignedBigInteger('attendance_session_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('attendance_record_id')->nullable()->index();
|
||||
$table->json('before_json')->nullable();
|
||||
$table->json('after_json')->nullable();
|
||||
$table->text('reason')->nullable();
|
||||
$table->string('source')->default('system');
|
||||
$table->string('station_id')->nullable()->index();
|
||||
$table->string('request_id')->nullable()->index();
|
||||
$table->string('idempotency_key')->nullable()->index();
|
||||
$table->json('metadata_json')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('attendance_idempotency_keys')) {
|
||||
Schema::create('attendance_idempotency_keys', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->string('operation');
|
||||
$table->string('idempotency_key');
|
||||
$table->string('payload_hash');
|
||||
$table->string('fingerprint')->nullable()->index();
|
||||
$table->json('result_json')->nullable();
|
||||
$table->timestamp('expires_at')->nullable()->index();
|
||||
$table->timestamps();
|
||||
$table->unique(['school_id', 'operation', 'idempotency_key'], 'attendance_idem_school_operation_key_unique');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_idempotency_keys');
|
||||
Schema::dropIfExists('attendance_audit_logs');
|
||||
Schema::dropIfExists('attendance_scan_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
<?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): void { if(!Schema::hasColumn('students','student_identifier')){$table->string('student_identifier')->nullable()->after('school_id');} if(!Schema::hasColumn('students','status')){$table->string('status')->default('active')->index();} if(!Schema::hasColumn('students','profile_metadata')){$table->json('profile_metadata')->nullable();} $table->index(['school_id','status'],'students_school_status_idx'); }); Schema::create('guardians',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->string('first_name'); $table->string('last_name'); $table->string('email')->nullable()->index(); $table->string('phone')->nullable()->index(); $table->json('metadata')->nullable(); $table->timestamps(); }); Schema::create('student_guardian',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('student_id')->index(); $table->unsignedBigInteger('guardian_id')->index(); $table->string('relationship_type')->index(); $table->boolean('emergency_contact')->default(false); $table->boolean('pickup_authorized')->default(false); $table->boolean('financial_responsibility')->nullable(); $table->boolean('academic_contact')->nullable(); $table->timestamp('effective_from')->nullable(); $table->timestamp('effective_to')->nullable(); $table->text('notes')->nullable(); $table->timestamps(); $table->unique(['school_id','student_id','guardian_id'],'student_guardian_unique'); }); Schema::create('households',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->string('name'); $table->string('primary_address')->nullable(); $table->json('metadata')->nullable(); $table->timestamps(); }); Schema::create('household_student',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('household_id')->index(); $table->unsignedBigInteger('student_id')->index(); $table->timestamps(); $table->unique(['school_id','household_id','student_id'],'household_student_unique'); }); Schema::create('household_guardian',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('household_id')->index(); $table->unsignedBigInteger('guardian_id')->index(); $table->timestamps(); $table->unique(['school_id','household_id','guardian_id'],'household_guardian_unique'); }); } public function down(): void { Schema::dropIfExists('household_guardian'); Schema::dropIfExists('household_student'); Schema::dropIfExists('households'); Schema::dropIfExists('student_guardian'); Schema::dropIfExists('guardians'); } };
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?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): void { $table->unique(['school_id','student_identifier'],'students_school_identifier_unique'); }); Schema::create('enrollments',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('student_id')->index(); $table->unsignedBigInteger('academic_year_id')->index(); $table->unsignedBigInteger('term_id')->nullable()->index(); $table->unsignedBigInteger('grade_level_id')->nullable()->index(); $table->unsignedBigInteger('program_id')->nullable()->index(); $table->unsignedBigInteger('class_group_id')->nullable()->index(); $table->string('status')->index(); $table->timestamp('enrolled_at')->nullable(); $table->timestamp('withdrawn_at')->nullable(); $table->string('reason')->nullable(); $table->json('metadata')->nullable(); $table->timestamps(); $table->index(['school_id','student_id','academic_year_id','term_id'],'enrollment_period_idx'); }); Schema::create('student_assignments',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('student_id')->index(); $table->string('assignment_type')->index(); $table->string('assignable_type')->index(); $table->unsignedBigInteger('assignable_id')->index(); $table->date('effective_from')->nullable(); $table->date('effective_to')->nullable(); $table->string('status')->index(); $table->json('metadata')->nullable(); $table->timestamps(); $table->index(['school_id','student_id','assignment_type'],'student_assignment_scope_idx'); }); Schema::create('student_audit_logs',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('actor_user_id')->nullable()->index(); $table->json('actor_role_snapshot')->nullable(); $table->string('action')->index(); $table->string('entity_type')->index(); $table->unsignedBigInteger('entity_id')->index(); $table->json('before_json')->nullable(); $table->json('after_json')->nullable(); $table->text('reason')->nullable(); $table->string('request_id')->nullable(); $table->string('ip_address')->nullable(); $table->text('user_agent')->nullable(); $table->string('idempotency_key')->nullable()->index(); $table->timestamp('created_at')->useCurrent()->index(); $table->index(['entity_type','entity_id'],'student_audit_entity_idx'); }); } public function down(): void { Schema::dropIfExists('student_audit_logs'); Schema::dropIfExists('student_assignments'); Schema::dropIfExists('enrollments'); } };
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?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('islamic_sunday_school_student_profiles',function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('student_id')->index(); $table->unsignedBigInteger('family_profile_id')->nullable()->index(); $table->unsignedBigInteger('quran_level_id')->nullable()->index(); $table->unsignedBigInteger('arabic_level_id')->nullable()->index(); $table->unsignedBigInteger('islamic_studies_track_id')->nullable()->index(); $table->unsignedBigInteger('halaqa_group_id')->nullable()->index(); $table->text('memorization_progress_summary')->nullable(); $table->string('recitation_placement')->nullable(); $table->boolean('volunteer_family_participation')->default(false); $table->text('sensitive_admin_notes')->nullable(); $table->json('metadata')->nullable(); $table->timestamps(); $table->unique(['school_id','student_id'],'iss_student_profile_unique'); }); } public function down(): void { Schema::dropIfExists('islamic_sunday_school_student_profiles'); } };
|
||||
@@ -0,0 +1,3 @@
|
||||
<?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('communication_recipient_previews', function(Blueprint $table): void { $table->uuid('id')->primary(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('actor_user_id')->index(); $table->string('audience_type')->index(); $table->json('audience_filters_json')->nullable(); $table->string('channel')->index(); $table->string('message_category')->index(); $table->unsignedInteger('recipient_count')->default(0); $table->unsignedInteger('deduped_count')->default(0); $table->unsignedInteger('blocked_count')->default(0); $table->unsignedInteger('missing_contact_count')->default(0); $table->longText('snapshot_json'); $table->string('confirmation_token_hash'); $table->timestamp('expires_at')->index(); $table->timestamps(); }); Schema::create('communication_messages', function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('actor_user_id')->index(); $table->string('channel')->index(); $table->string('message_category')->index(); $table->string('priority')->default('normal'); $table->string('subject')->nullable(); $table->longText('body_snapshot'); $table->uuid('preview_id')->nullable()->index(); $table->string('status')->index(); $table->timestamp('scheduled_at')->nullable(); $table->timestamp('sent_at')->nullable(); $table->timestamps(); }); Schema::create('communication_message_recipients', function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('message_id')->index(); $table->unsignedBigInteger('school_id')->index(); $table->string('recipient_type'); $table->string('recipient_id'); $table->string('channel')->index(); $table->string('delivery_address_hash')->nullable(); $table->string('delivery_address_masked')->nullable(); $table->string('status')->index(); $table->string('excluded_reason')->nullable(); $table->string('provider_message_id')->nullable()->index(); $table->timestamps(); $table->index(['recipient_type','recipient_id']); }); } public function down(): void { Schema::dropIfExists('communication_message_recipients'); Schema::dropIfExists('communication_messages'); Schema::dropIfExists('communication_recipient_previews'); } };
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?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('communication_delivery_attempts', function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('message_recipient_id')->index(); $table->string('provider_message_id')->nullable()->index(); $table->string('status')->index(); $table->string('failure_reason')->nullable(); $table->unsignedInteger('attempt_number')->default(1); $table->json('raw_provider_payload')->nullable(); $table->timestamps(); }); Schema::create('communication_preferences', function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->string('recipient_type'); $table->string('recipient_id'); $table->string('channel')->index(); $table->string('message_category')->default('general'); $table->boolean('allowed')->default(true); $table->json('metadata_json')->nullable(); $table->timestamps(); $table->index(['recipient_type','recipient_id']); }); Schema::create('communication_templates', function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->nullable()->index(); $table->string('template_key')->index(); $table->unsignedInteger('version')->default(1); $table->string('name'); $table->string('subject')->nullable(); $table->longText('body'); $table->string('language')->default('en'); $table->json('required_variables_json')->nullable(); $table->string('status')->index(); $table->json('metadata_json')->nullable(); $table->timestamps(); $table->unique(['school_id','template_key','version'], 'comm_templates_school_key_version_unique'); }); Schema::create('communication_audit_logs', function(Blueprint $table): void { $table->id(); $table->unsignedBigInteger('school_id')->index(); $table->unsignedBigInteger('actor_user_id')->nullable()->index(); $table->string('action')->index(); $table->string('entity_type'); $table->string('entity_id'); $table->json('before_json')->nullable(); $table->json('after_json')->nullable(); $table->string('reason')->nullable(); $table->string('idempotency_key')->nullable(); $table->json('metadata_json')->nullable(); $table->timestamps(); $table->index(['entity_type','entity_id']); }); } public function down(): void { Schema::dropIfExists('communication_audit_logs'); Schema::dropIfExists('communication_templates'); Schema::dropIfExists('communication_preferences'); Schema::dropIfExists('communication_delivery_attempts'); } };
|
||||
@@ -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 {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('report_snapshots', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('actor_user_id')->index();
|
||||
$table->string('report_key')->index();
|
||||
$table->json('filters_json')->nullable();
|
||||
$table->json('columns_json')->nullable();
|
||||
$table->json('result_summary_json')->nullable();
|
||||
$table->string('snapshot_storage_path')->nullable();
|
||||
$table->boolean('sensitive_data_flag')->default(false);
|
||||
$table->timestamp('expires_at')->nullable()->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('report_audit_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('actor_user_id')->nullable()->index();
|
||||
$table->string('action');
|
||||
$table->string('report_key')->index();
|
||||
$table->json('filters_json')->nullable();
|
||||
$table->json('columns_json')->nullable();
|
||||
$table->string('format')->nullable();
|
||||
$table->unsignedInteger('row_count')->nullable();
|
||||
$table->boolean('sensitive_data_flag')->default(false);
|
||||
$table->string('request_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index(['school_id', 'report_key', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('report_audit_logs');
|
||||
Schema::dropIfExists('report_snapshots');
|
||||
}
|
||||
};
|
||||
@@ -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('scheduled_reports', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('school_id')->index();
|
||||
$table->unsignedBigInteger('actor_user_id')->index();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('report_key')->index();
|
||||
$table->json('filters_json')->nullable();
|
||||
$table->json('columns_json')->nullable();
|
||||
$table->string('format')->default('csv');
|
||||
$table->string('frequency');
|
||||
$table->timestamp('next_run_at')->nullable()->index();
|
||||
$table->string('status')->default('active')->index();
|
||||
$table->json('recipient_user_ids_json')->nullable();
|
||||
$table->json('recipient_emails_json')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['school_id', 'name']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('scheduled_reports');
|
||||
}
|
||||
};
|
||||
@@ -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('api_route_inventory_snapshots', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('snapshot_key')->unique();
|
||||
$table->json('routes_json');
|
||||
$table->unsignedBigInteger('created_by_user_id')->nullable()->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('api_route_inventory_snapshots');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user