add projet
This commit is contained in:
Executable
+1
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`school_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`firstname` varchar(255) NOT NULL,
|
||||
`lastname` varchar(255) NOT NULL,
|
||||
`gender` enum('Male','Female') DEFAULT NULL,
|
||||
`cellphone` varchar(25) NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`address_street` varchar(255) NOT NULL,
|
||||
`apt` varchar(25) DEFAULT NULL,
|
||||
`city` varchar(255) NOT NULL,
|
||||
`state` varchar(25) NOT NULL,
|
||||
`zip` varchar(25) NOT NULL,
|
||||
`accept_school_policy` tinyint(1) NOT NULL,
|
||||
`is_verified` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`status` varchar(10) NOT NULL DEFAULT 'Inactive',
|
||||
`is_suspended` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`failed_attempts` int(11) DEFAULT 0,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`token` varchar(255) DEFAULT NULL,
|
||||
`account_id` varchar(255) DEFAULT NULL,
|
||||
`user_type` enum('primary','secondary','tertiary') DEFAULT 'primary',
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`rfid_tag` varchar(100) DEFAULT NULL,
|
||||
`last_failed_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `users`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `users`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=312;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `students` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`school_id` char(100) NOT NULL,
|
||||
`firstname` varchar(255) NOT NULL,
|
||||
`lastname` varchar(255) NOT NULL,
|
||||
`dob` date DEFAULT NULL,
|
||||
`age` int(11) NOT NULL,
|
||||
`gender` varchar(10) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`registration_grade` varchar(50) DEFAULT NULL,
|
||||
`is_new` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1 = new student, 0 = returning student',
|
||||
`photo_consent` tinyint(1) NOT NULL,
|
||||
`parent_id` int(11) NOT NULL,
|
||||
`registration_date` datetime DEFAULT NULL,
|
||||
`tuition_paid` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`rfid_tag` varchar(100) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL,
|
||||
`year_of_registration` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `students`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `students`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=261;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('students');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `expenses` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`category` enum('Expense','Purchase','Reimbursement','Donation') NOT NULL,
|
||||
`amount` decimal(10,2) NOT NULL,
|
||||
`receipt_path` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`retailor` varchar(255) DEFAULT NULL,
|
||||
`purchased_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`date_of_purchase` date NOT NULL,
|
||||
`added_by` int(11) UNSIGNED NOT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL,
|
||||
`status` enum('pending','approved','denied') NOT NULL DEFAULT 'pending',
|
||||
`status_reason` text DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`approved_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`reimbursement_id` int(11) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `expenses`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `expenses`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=62;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('expenses');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `flag` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`student_name` varchar(255) NOT NULL,
|
||||
`grade` varchar(50) NOT NULL,
|
||||
`flag` enum('payment','attendance','grade','behavior','talking_off_task','calling_out','minor_disruption','minor_dress_code','forgetting_materials','repeated_defiance','disrespectful_tone','minor_profanity','repeated_tardiness','device_misuse','minor_conflict','bullying_harassment','fighting_aggression','threats','theft','vandalism','sexual_harassment','serious_cyber_incident','contraband','weapons_drugs','other') NOT NULL,
|
||||
`flag_datetime` datetime NOT NULL,
|
||||
`flag_state` enum('Closed','Canceled') NOT NULL,
|
||||
`updated_by_open` int(11) DEFAULT NULL,
|
||||
`open_description` text DEFAULT NULL,
|
||||
`updated_by_closed` int(11) DEFAULT NULL,
|
||||
`close_description` text DEFAULT NULL,
|
||||
`action_taken` text DEFAULT NULL,
|
||||
`updated_by_canceled` int(11) DEFAULT NULL,
|
||||
`cancel_description` text DEFAULT NULL,
|
||||
`semester` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`school_year` varchar(9) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `flag`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `flag`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flag');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `grading_locks` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) UNSIGNED NOT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`is_locked` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`locked_by` int(11) DEFAULT NULL,
|
||||
`locked_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `grading_locks`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_grading_locks_section_term` (`class_section_id`,`semester`,`school_year`),
|
||||
ADD KEY `idx_grading_locks_section_term` (`class_section_id`,`semester`,`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `grading_locks`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('grading_locks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `homework` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
`homework_index` tinyint(4) DEFAULT NULL,
|
||||
`score` float DEFAULT NULL,
|
||||
`comment` text DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `homework`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `homework`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('homework');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `inventory_categories` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`type` enum('classroom','book','office','kitchen') NOT NULL DEFAULT 'office',
|
||||
`name` varchar(120) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`grade_min` tinyint(3) UNSIGNED DEFAULT NULL,
|
||||
`grade_max` tinyint(3) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_categories`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `type_name` (`type`,`name`),
|
||||
ADD KEY `idx_cat_type_grade_range` (`type`,`grade_min`,`grade_max`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_categories`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('inventory_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `inventory_items` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`type` enum('classroom','book','office','kitchen') NOT NULL,
|
||||
`category_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`name` varchar(190) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`quantity` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`good_qty` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`needs_repair_qty` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`need_replace_qty` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`cannot_find_qty` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`unit` varchar(32) DEFAULT NULL,
|
||||
`condition` enum('good','needs_repair','need_replace','cannot_find') DEFAULT NULL,
|
||||
`isbn` varchar(32) DEFAULT NULL,
|
||||
`edition` varchar(32) DEFAULT NULL,
|
||||
`sku` varchar(64) DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`semester` enum('Spring','Fall') DEFAULT NULL,
|
||||
`school_year` varchar(16) DEFAULT NULL,
|
||||
`updated_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_items`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `type_name` (`type`,`name`),
|
||||
ADD KEY `school_year_semester` (`school_year`,`semester`),
|
||||
ADD KEY `category_id` (`category_id`),
|
||||
ADD KEY `updated_by` (`updated_by`),
|
||||
ADD KEY `idx_items_schoolyear_semester` (`school_year`,`semester`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_items`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_items`
|
||||
ADD CONSTRAINT `inventory_items_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `inventory_categories` (`id`) ON DELETE CASCADE ON UPDATE SET NULL;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('inventory_items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `inventory_movements` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`item_id` int(10) UNSIGNED NOT NULL,
|
||||
`qty_change` int(11) NOT NULL,
|
||||
`movement_type` enum('initial','in','out','adjust','distribution') NOT NULL DEFAULT 'adjust',
|
||||
`reason` varchar(120) DEFAULT NULL,
|
||||
`note` text DEFAULT NULL,
|
||||
`semester` enum('Spring','Fall') DEFAULT NULL,
|
||||
`school_year` varchar(16) DEFAULT NULL,
|
||||
`performed_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`teacher_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`student_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`class_section_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_movements`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `item_id` (`item_id`),
|
||||
ADD KEY `school_year_semester` (`school_year`,`semester`),
|
||||
ADD KEY `movement_type` (`movement_type`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_movements`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=421;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `inventory_movements`
|
||||
ADD CONSTRAINT `inventory_movements_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `inventory_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('inventory_movements');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `invoice_event` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`invoice_id` int(11) UNSIGNED NOT NULL,
|
||||
`event_name` varchar(255) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`amount` decimal(10,2) NOT NULL,
|
||||
`semester` varchar(50) DEFAULT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `invoice_event`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `invoice_event`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_event');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `invoices` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`parent_id` int(11) NOT NULL,
|
||||
`invoice_number` varchar(50) NOT NULL,
|
||||
`total_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`balance` decimal(10,2) DEFAULT 0.00,
|
||||
`paid_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`has_discount` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 if discount applied, 0 no discount',
|
||||
`issue_date` date NOT NULL,
|
||||
`due_date` date DEFAULT NULL,
|
||||
`status` varchar(50) NOT NULL DEFAULT '''unpaid''',
|
||||
`description` text DEFAULT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`updated_by` int(11) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `invoices`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `invoices`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoices');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `invoice_students_list` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`invoice_id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`student_firstname` varchar(100) NOT NULL,
|
||||
`student_lastname` varchar(100) NOT NULL,
|
||||
`school_id` int(11) UNSIGNED NOT NULL,
|
||||
`enrolled` tinyint(1) DEFAULT 1,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `invoice_students_list`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `invoice_students_list`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_students_list');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `ip_attempts` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`ip_address` varchar(45) NOT NULL,
|
||||
`attempts` int(11) NOT NULL DEFAULT 0,
|
||||
`last_attempt_at` datetime NOT NULL,
|
||||
`blocked_until` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `ip_attempts`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `ip_attempts`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ip_attempts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `late_slip_logs` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`school_year` varchar(32) DEFAULT NULL,
|
||||
`semester` varchar(32) DEFAULT NULL,
|
||||
`student_name` varchar(191) NOT NULL,
|
||||
`slip_date` date DEFAULT NULL,
|
||||
`time_in` time DEFAULT NULL,
|
||||
`grade` varchar(64) DEFAULT NULL,
|
||||
`reason` varchar(255) DEFAULT NULL,
|
||||
`admin_name` varchar(191) DEFAULT NULL,
|
||||
`printed_by` int(11) DEFAULT NULL,
|
||||
`printed_at` datetime NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `late_slip_logs`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `school_year` (`school_year`),
|
||||
ADD KEY `student_name` (`student_name`),
|
||||
ADD KEY `idx_late_slip_year_sem` (`school_year`,`semester`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `late_slip_logs`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('late_slip_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `login_activity` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`login_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`logout_time` timestamp NULL DEFAULT NULL,
|
||||
`ip_address` varchar(255) NOT NULL,
|
||||
`user_agent` varchar(255) NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `login_activity`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `login_activity`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('login_activity');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `manual_payments` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`invoice_number` varchar(100) DEFAULT NULL,
|
||||
`amount` decimal(10,2) DEFAULT NULL,
|
||||
`payment_method` varchar(100) DEFAULT NULL,
|
||||
`reference` varchar(255) DEFAULT NULL,
|
||||
`discount_number` int(11) DEFAULT NULL,
|
||||
`proof_path` varchar(255) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `manual_payments`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `manual_payments`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('manual_payments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `messages` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`sender_id` int(11) NOT NULL,
|
||||
`recipient_id` int(11) NOT NULL,
|
||||
`subject` varchar(255) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`sent_datetime` datetime NOT NULL,
|
||||
`read_status` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`read_datetime` datetime DEFAULT NULL,
|
||||
`message_number` varchar(20) NOT NULL,
|
||||
`priority` varchar(10) NOT NULL DEFAULT 'normal',
|
||||
`attachment` varchar(255) DEFAULT NULL,
|
||||
`status` varchar(10) NOT NULL DEFAULT 'sent',
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `messages`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `messages`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('messages');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `midterm_exam` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
`score` float DEFAULT NULL,
|
||||
`comment` text DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL DEFAULT 'Fall',
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `midterm_exam`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `midterm_exam`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('midterm_exam');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `missing_score_overrides` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) UNSIGNED NOT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`item_type` varchar(30) NOT NULL,
|
||||
`item_index` int(11) DEFAULT NULL,
|
||||
`is_allowed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `missing_score_overrides`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `missing_score_overrides_unique` (`student_id`,`class_section_id`,`semester`,`school_year`,`item_type`,`item_index`),
|
||||
ADD KEY `missing_score_overrides_scope` (`class_section_id`,`semester`,`school_year`,`item_type`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `missing_score_overrides`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('missing_score_overrides');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `nav_items` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`menu_parent_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`label` varchar(100) NOT NULL,
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`icon_class` varchar(100) DEFAULT NULL,
|
||||
`target` varchar(20) DEFAULT NULL,
|
||||
`sort_order` int(11) NOT NULL DEFAULT 0,
|
||||
`is_enabled` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`deleted_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `nav_items`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `nav_items`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('nav_items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `notifications` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`message` text NOT NULL,
|
||||
`target_group` enum('student','parent','teacher','admin','everyone') NOT NULL,
|
||||
`delivery_channels` set('in_app','email','sms') NOT NULL,
|
||||
`priority` enum('low','normal','high') DEFAULT 'normal',
|
||||
`status` enum('pending','sent','failed') DEFAULT 'pending',
|
||||
`action_url` varchar(512) DEFAULT NULL,
|
||||
`attachment_path` varchar(512) DEFAULT NULL,
|
||||
`scheduled_at` datetime DEFAULT current_timestamp(),
|
||||
`sent_at` datetime DEFAULT NULL,
|
||||
`expires_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`deleted_at` datetime DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `notifications`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `notifications`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `parent_attendance_reports` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`parent_id` int(10) UNSIGNED NOT NULL COMMENT 'users.id of the reporting parent (primary parent id)',
|
||||
`student_id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`report_date` date NOT NULL,
|
||||
`type` enum('absent','late','early_dismissal') NOT NULL DEFAULT 'absent',
|
||||
`arrival_time` time DEFAULT NULL,
|
||||
`dismiss_time` time DEFAULT NULL,
|
||||
`reason` text DEFAULT NULL,
|
||||
`semester` varchar(32) DEFAULT NULL,
|
||||
`school_year` varchar(16) DEFAULT NULL,
|
||||
`status` enum('new','seen','processed') NOT NULL DEFAULT 'new',
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_attendance_reports`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `parent_attendance_reports_parent_id_foreign` (`parent_id`),
|
||||
ADD KEY `report_date` (`report_date`),
|
||||
ADD KEY `student_id_report_date` (`student_id`,`report_date`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_attendance_reports`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_attendance_reports`
|
||||
ADD CONSTRAINT `parent_attendance_reports_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `parent_attendance_reports_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('parent_attendance_reports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `parent_meeting_schedules` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`student_id` int(10) UNSIGNED NOT NULL,
|
||||
`parent_user_id` int(10) UNSIGNED NOT NULL,
|
||||
`parent_name` varchar(255) DEFAULT NULL,
|
||||
`student_name` varchar(255) DEFAULT NULL,
|
||||
`class_section_name` varchar(255) DEFAULT NULL,
|
||||
`date` date NOT NULL,
|
||||
`time` time NOT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`status` enum('pending','approved','rejected','cancelled','completed') NOT NULL DEFAULT 'pending',
|
||||
`created_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_meeting_schedules`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_pms_student_id` (`student_id`),
|
||||
ADD KEY `idx_pms_parent_user_id` (`parent_user_id`),
|
||||
ADD KEY `idx_pms_date_time` (`date`,`time`),
|
||||
ADD KEY `idx_pms_semester_year` (`semester`,`school_year`),
|
||||
ADD KEY `idx_pms_status` (`status`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_meeting_schedules`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('parent_meeting_schedules');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `parents` (
|
||||
`id` int(11) NOT NULL,
|
||||
`secondparent_firstname` varchar(100) NOT NULL,
|
||||
`secondparent_lastname` varchar(100) NOT NULL,
|
||||
`secondparent_gender` enum('Male','Female') DEFAULT NULL,
|
||||
`secondparent_email` varchar(150) NOT NULL,
|
||||
`secondparent_phone` varchar(15) NOT NULL,
|
||||
`firstparent_id` int(11) NOT NULL,
|
||||
`secondparent_id` int(11) NOT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parents`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parents`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('parents');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `parent_notifications` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`student_id` int(10) UNSIGNED NOT NULL,
|
||||
`code` varchar(32) NOT NULL,
|
||||
`incident_date` date NOT NULL,
|
||||
`channel` enum('email','sms','call','whatsapp') NOT NULL DEFAULT 'email',
|
||||
`to_address` varchar(255) DEFAULT NULL,
|
||||
`subject` varchar(255) DEFAULT NULL,
|
||||
`status` enum('sent','failed') NOT NULL,
|
||||
`response` text DEFAULT NULL,
|
||||
`semester` varchar(16) DEFAULT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_notifications`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_notif` (`student_id`,`code`,`incident_date`,`channel`,`to_address`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `parent_notifications`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('parent_notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `participation` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
`score` float DEFAULT NULL,
|
||||
`comment` text DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `participation`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `participation`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('participation');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `password_resets` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`token` varchar(255) NOT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`expires_at` datetime NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `password_resets`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `password_resets`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `password_reset_requests` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`ip_address` varchar(45) NOT NULL,
|
||||
`requested_at` datetime NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `password_reset_requests`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `password_reset_requests`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_requests');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `reimbursement_batches` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`title` varchar(120) DEFAULT NULL,
|
||||
`yearly_batch_number` int(11) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`status` enum('open','closed') DEFAULT 'open',
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL,
|
||||
`created_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`closed_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`opened_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`closed_at` datetime DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batches`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_status` (`status`),
|
||||
ADD KEY `idx_created_by` (`created_by`),
|
||||
ADD KEY `fk_batch_closed_by` (`closed_by`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batches`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batches`
|
||||
ADD CONSTRAINT `fk_batch_closed_by` FOREIGN KEY (`closed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
|
||||
ADD CONSTRAINT `fk_batch_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('reimbursement_batches');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `paypal_payments` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`webhook_id` varchar(64) DEFAULT NULL,
|
||||
`parent_school_id` varchar(64) DEFAULT NULL,
|
||||
`order_id` varchar(64) DEFAULT NULL,
|
||||
`transaction_id` varchar(64) DEFAULT NULL,
|
||||
`status` varchar(32) DEFAULT NULL,
|
||||
`amount` decimal(10,2) DEFAULT NULL,
|
||||
`currency` varchar(10) DEFAULT NULL,
|
||||
`paypal_fee` decimal(10,2) DEFAULT NULL,
|
||||
`net_amount` decimal(10,2) DEFAULT NULL,
|
||||
`payer_email` varchar(128) DEFAULT NULL,
|
||||
`merchant_id` varchar(64) DEFAULT NULL,
|
||||
`event_type` varchar(64) DEFAULT NULL,
|
||||
`summary` text DEFAULT NULL,
|
||||
`raw_payload` longtext DEFAULT NULL,
|
||||
`synced` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`sync_attempts` int(11) NOT NULL DEFAULT 0,
|
||||
`created_at` datetime DEFAULT current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `paypal_payments`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `paypal_payments`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('paypal_payments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `reimbursements` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`expense_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`amount` decimal(10,2) NOT NULL,
|
||||
`reimbursed_to` int(11) UNSIGNED NOT NULL,
|
||||
`approved_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`receipt_path` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`status` enum('Pending','Approved','Rejected','Paid') DEFAULT 'Pending',
|
||||
`added_by` int(11) UNSIGNED NOT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL,
|
||||
`check_number` varchar(100) DEFAULT NULL,
|
||||
`reimbursement_method` enum('Cash','Check') DEFAULT NULL,
|
||||
`batch_number` int(11) UNSIGNED NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursements`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursements`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('reimbursements');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `payment_error` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`payment_id` int(11) NOT NULL,
|
||||
`invoice_id` int(11) NOT NULL,
|
||||
`parent_id` int(11) NOT NULL,
|
||||
`wrong_paid_amount` decimal(10,2) NOT NULL,
|
||||
`wrong_payment_method` varchar(50) NOT NULL,
|
||||
`wrong_check_file` varchar(255) DEFAULT NULL,
|
||||
`error_note` varchar(255) DEFAULT NULL,
|
||||
`logged_at` datetime NOT NULL,
|
||||
`logged_by` int(11) DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payment_error`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payment_error`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_error');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `payments` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`parent_id` int(11) UNSIGNED NOT NULL,
|
||||
`invoice_id` int(11) UNSIGNED NOT NULL,
|
||||
`total_amount` decimal(10,2) NOT NULL,
|
||||
`paid_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`balance` decimal(10,2) NOT NULL,
|
||||
`number_of_installments` int(11) NOT NULL,
|
||||
`transaction_id` varchar(100) DEFAULT NULL,
|
||||
`check_file` varchar(255) DEFAULT NULL,
|
||||
`check_number` varchar(100) DEFAULT NULL,
|
||||
`payment_method` varchar(50) NOT NULL DEFAULT 'Unknown',
|
||||
`payment_date` date NOT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`status` varchar(50) NOT NULL DEFAULT 'Pending',
|
||||
`updated_by` int(11) DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payments`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payments`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `payment_notification_logs` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`parent_id` int(11) UNSIGNED NOT NULL,
|
||||
`invoice_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`school_year` varchar(32) DEFAULT NULL,
|
||||
`period_year` smallint(4) NOT NULL,
|
||||
`period_month` tinyint(2) NOT NULL,
|
||||
`type` enum('no_payment','installment') NOT NULL DEFAULT 'installment',
|
||||
`to_email` varchar(191) DEFAULT NULL,
|
||||
`cc_email` varchar(191) DEFAULT NULL,
|
||||
`head_fa_notified` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`subject` varchar(255) DEFAULT NULL,
|
||||
`body` mediumtext DEFAULT NULL,
|
||||
`status` enum('sent','failed') NOT NULL DEFAULT 'sent',
|
||||
`error_message` text DEFAULT NULL,
|
||||
`balance_snapshot` decimal(10,2) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`sent_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payment_notification_logs`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `parent_id_period_year_period_month_type` (`parent_id`,`period_year`,`period_month`,`type`),
|
||||
ADD KEY `parent_id` (`parent_id`),
|
||||
ADD KEY `invoice_id` (`invoice_id`),
|
||||
ADD KEY `school_year` (`school_year`),
|
||||
ADD KEY `period_year_period_month` (`period_year`,`period_month`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payment_notification_logs`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_notification_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `payment_transactions` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`transaction_id` varchar(100) NOT NULL,
|
||||
`payment_id` int(11) NOT NULL,
|
||||
`transaction_date` datetime DEFAULT current_timestamp(),
|
||||
`amount` decimal(10,2) NOT NULL,
|
||||
`payment_method` varchar(50) NOT NULL,
|
||||
`payment_status` varchar(50) NOT NULL DEFAULT 'Pending',
|
||||
`transaction_fee` decimal(10,2) DEFAULT 0.00,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payment_transactions`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `payment_transactions`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_transactions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `paypal_transactions` (
|
||||
`id` int(11) NOT NULL,
|
||||
`transaction_id` varchar(100) NOT NULL,
|
||||
`payment_id` int(11) DEFAULT NULL,
|
||||
`firstname` varchar(100) DEFAULT NULL,
|
||||
`lastname` varchar(100) DEFAULT NULL,
|
||||
`event_type` varchar(100) NOT NULL,
|
||||
`payer_email` varchar(255) DEFAULT NULL,
|
||||
`amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`currency` varchar(10) NOT NULL,
|
||||
`status` varchar(50) NOT NULL DEFAULT 'Pending',
|
||||
`payment_method` varchar(50) NOT NULL,
|
||||
`transaction_fee` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`raw_data` text DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `paypal_transactions`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `paypal_transactions`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('paypal_transactions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `permissions` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `permissions`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `permissions`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `placement_batches` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`placement_test` varchar(30) NOT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`created_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_batches`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_placement_test_school_year` (`placement_test`,`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_batches`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('placement_batches');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `placement_levels` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`level` tinyint(1) UNSIGNED NOT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`created_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_levels`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_student_year` (`student_id`,`school_year`),
|
||||
ADD KEY `idx_school_year` (`school_year`),
|
||||
ADD KEY `fk_placement_levels_created_by` (`created_by`),
|
||||
ADD KEY `fk_placement_levels_updated_by` (`updated_by`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_levels`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_levels`
|
||||
ADD CONSTRAINT `fk_placement_levels_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_placement_levels_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_placement_levels_updated_by` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('placement_levels');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `placement_scores` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`batch_id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`score` smallint(3) UNSIGNED NOT NULL,
|
||||
`created_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_scores`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uq_batch_student` (`batch_id`,`student_id`),
|
||||
ADD KEY `idx_batch_id` (`batch_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `placement_scores`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('placement_scores');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `user_preferences` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`notification_email` tinyint(1) DEFAULT 1,
|
||||
`notification_sms` tinyint(1) DEFAULT 1,
|
||||
`theme` varchar(50) DEFAULT 'light',
|
||||
`language` varchar(50) DEFAULT 'en',
|
||||
`style_color` varchar(32) DEFAULT NULL,
|
||||
`menu_color` varchar(32) DEFAULT NULL,
|
||||
`menu_custom_bg` varchar(16) DEFAULT NULL,
|
||||
`menu_custom_text` varchar(16) DEFAULT NULL,
|
||||
`menu_custom_mode` varchar(8) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `user_preferences`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `user_preferences`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_preferences');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `print_requests` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`teacher_id` int(11) UNSIGNED NOT NULL,
|
||||
`admin_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`class_id` int(11) UNSIGNED NOT NULL,
|
||||
`file_path` varchar(255) NOT NULL,
|
||||
`page_selection` varchar(255) DEFAULT NULL,
|
||||
`num_copies` int(11) NOT NULL,
|
||||
`required_by` datetime NOT NULL,
|
||||
`pickup_method` varchar(255) NOT NULL,
|
||||
`status` enum('not_assigned','assigned','done','delivered') NOT NULL DEFAULT 'not_assigned',
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `print_requests`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `print_requests_teacher_id_foreign` (`teacher_id`),
|
||||
ADD KEY `print_requests_admin_id_foreign` (`admin_id`),
|
||||
ADD KEY `print_requests_class_id_foreign` (`class_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `print_requests`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `print_requests`
|
||||
ADD CONSTRAINT `print_requests_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `print_requests_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('print_requests');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `project` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
`project_index` tinyint(4) DEFAULT NULL,
|
||||
`score` float DEFAULT NULL,
|
||||
`comment` text DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `project`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `project`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `promotion_queue` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`from_class_section_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`to_class_id` int(11) UNSIGNED NOT NULL,
|
||||
`to_class_section_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`school_year_from` varchar(9) NOT NULL,
|
||||
`school_year_to` varchar(9) NOT NULL,
|
||||
`status` enum('queued','assigned','applied','cancelled') NOT NULL DEFAULT 'queued',
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `promotion_queue`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uq_student_year_to` (`student_id`,`school_year_to`),
|
||||
ADD KEY `to_class_id` (`to_class_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `promotion_queue`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('promotion_queue');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `quiz` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
`quiz_index` tinyint(11) NOT NULL,
|
||||
`score` float DEFAULT NULL,
|
||||
`comment` text DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `quiz`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `quiz`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('quiz');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `refunds` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`parent_id` int(11) UNSIGNED NOT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`invoice_id` int(11) UNSIGNED DEFAULT NULL,
|
||||
`refund_amount` decimal(10,2) NOT NULL,
|
||||
`requested_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`approved_at` datetime DEFAULT NULL,
|
||||
`refunded_at` datetime DEFAULT NULL,
|
||||
`status` enum('Pending','Partial','Approved','Rejected','Paid') NOT NULL DEFAULT 'Pending',
|
||||
`reason` varchar(255) DEFAULT NULL,
|
||||
`refund_paid_amount` decimal(10,2) NOT NULL,
|
||||
`request` varchar(25) DEFAULT NULL,
|
||||
`note` text DEFAULT NULL,
|
||||
`approved_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`updated_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`refund_method` enum('Check','Online','Cash') DEFAULT NULL,
|
||||
`check_nbr` varchar(100) DEFAULT NULL,
|
||||
`check_file` varchar(255) DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `refunds`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `refunds`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('refunds');
|
||||
}
|
||||
};
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `reimbursement_batch_admin_files` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`batch_id` int(11) UNSIGNED NOT NULL,
|
||||
`admin_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`filename` varchar(255) NOT NULL,
|
||||
`original_filename` varchar(255) DEFAULT NULL,
|
||||
`uploaded_at` datetime NOT NULL,
|
||||
`uploaded_by` int(11) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batch_admin_files`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `batch_admin_unique` (`batch_id`,`admin_id`),
|
||||
ADD KEY `batch_id` (`batch_id`),
|
||||
ADD KEY `admin_id` (`admin_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batch_admin_files`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('reimbursement_batch_admin_files');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `roles` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`slug` varchar(64) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`dashboard_route` varchar(255) NOT NULL DEFAULT 'administrator/administratordashboard',
|
||||
`priority` int(10) UNSIGNED NOT NULL DEFAULT 100,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `roles`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `roles`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `role_nav_items` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`role_id` int(11) UNSIGNED NOT NULL,
|
||||
`nav_item_id` int(10) UNSIGNED NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `role_nav_items`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `role_nav_items`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('role_nav_items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `role_permissions` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`role_id` int(11) NOT NULL,
|
||||
`permission_id` int(11) NOT NULL,
|
||||
`can_create` tinyint(1) DEFAULT 0,
|
||||
`can_read` tinyint(1) DEFAULT 0,
|
||||
`can_update` tinyint(1) DEFAULT 0,
|
||||
`can_delete` tinyint(1) DEFAULT 0,
|
||||
`can_manage` tinyint(1) DEFAULT 0,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `role_permissions`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `role_permissions`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('role_permissions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `score_comments` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`score_type` varchar(50) NOT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`comment` text DEFAULT NULL,
|
||||
`comment_review` text DEFAULT NULL,
|
||||
`reviewed_by` int(11) UNSIGNED DEFAULT NULL,
|
||||
`commented_by` int(11) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `score_comments`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `score_comments`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('score_comments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `sections` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`section_name` varchar(100) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `sections`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `sections`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sections');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `semester_scores` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL,
|
||||
`homework_avg` float DEFAULT NULL,
|
||||
`quiz_avg` float DEFAULT NULL,
|
||||
`project_avg` float DEFAULT NULL,
|
||||
`midterm_exam_score` float DEFAULT NULL,
|
||||
`final_exam_score` float DEFAULT NULL,
|
||||
`attendance_score` float DEFAULT NULL,
|
||||
`participation_score` float DEFAULT NULL,
|
||||
`ptap_score` decimal(5,2) DEFAULT NULL,
|
||||
`test_avg` float DEFAULT NULL,
|
||||
`semester_score` float DEFAULT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `semester_scores`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uq_semester_scores_nk` (`student_id`,`class_section_id`,`semester`,`school_year`),
|
||||
ADD KEY `idx_student_id` (`student_id`),
|
||||
ADD KEY `idx_semester_school_year` (`semester`,`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `semester_scores`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('semester_scores');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `settings` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`timezone` varchar(255) NOT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `settings`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `settings`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `staff_attendance` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`user_id` int(10) UNSIGNED NOT NULL,
|
||||
`role_name` varchar(64) DEFAULT NULL,
|
||||
`date` date NOT NULL,
|
||||
`semester` varchar(32) NOT NULL,
|
||||
`school_year` varchar(16) NOT NULL,
|
||||
`status` enum('present','absent','late') NOT NULL DEFAULT 'present',
|
||||
`reason` varchar(255) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`created_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`updated_by` int(10) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `staff_attendance`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_staff_att` (`user_id`,`role_name`,`date`,`semester`,`school_year`),
|
||||
ADD KEY `idx_staff_att_user` (`user_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `staff_attendance`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1000;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `staff_attendance`
|
||||
ADD CONSTRAINT `staff_attendance_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('staff_attendance');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `staff` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`firstname` varchar(100) NOT NULL,
|
||||
`lastname` varchar(100) NOT NULL,
|
||||
`email` varchar(150) NOT NULL,
|
||||
`phone` varchar(20) DEFAULT NULL,
|
||||
`role_name` varchar(100) NOT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`active_role` varchar(100) DEFAULT 'Active',
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`user_id` int(11) UNSIGNED NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `staff`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `email` (`email`),
|
||||
ADD UNIQUE KEY `user_id` (`user_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `staff`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=113;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('staff');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `student_allergies` (
|
||||
`id` int(11) NOT NULL,
|
||||
`student_id` int(10) UNSIGNED NOT NULL,
|
||||
`allergy` varchar(100) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_allergies`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `student_id` (`student_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_allergies`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_allergies`
|
||||
ADD CONSTRAINT `student_allergies_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('student_allergies');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `student_class` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`is_event_only` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(25) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_class`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_class`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('student_class');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `student_medical_conditions` (
|
||||
`id` int(11) NOT NULL,
|
||||
`student_id` int(10) UNSIGNED NOT NULL,
|
||||
`condition_name` varchar(100) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_medical_conditions`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `student_id` (`student_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_medical_conditions`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `student_medical_conditions`
|
||||
ADD CONSTRAINT `student_medical_conditions_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('student_medical_conditions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `subject_curriculum_items` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_id` int(11) UNSIGNED NOT NULL,
|
||||
`subject` enum('islamic','quran') NOT NULL DEFAULT 'islamic',
|
||||
`unit_number` smallint(6) DEFAULT NULL,
|
||||
`unit_title` varchar(255) DEFAULT NULL,
|
||||
`chapter_name` varchar(255) NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `subject_curriculum_items`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_class_subject` (`class_id`,`subject`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `subject_curriculum_items`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('subject_curriculum_items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `teacher_class` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`teacher_id` int(11) DEFAULT NULL,
|
||||
`position` enum('main','ta') DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(25) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `teacher_class`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `unique_teacher_assignment` (`teacher_id`,`class_section_id`,`semester`,`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `teacher_class`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('teacher_class');
|
||||
}
|
||||
};
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `teacher_submission_notification_history` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`teacher_id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(10) UNSIGNED NOT NULL,
|
||||
`admin_id` int(10) UNSIGNED NOT NULL,
|
||||
`notification_category` varchar(64) NOT NULL DEFAULT 'teacher_submissions',
|
||||
`message` text DEFAULT NULL,
|
||||
`status` varchar(32) NOT NULL DEFAULT 'sent',
|
||||
`school_year` varchar(32) DEFAULT NULL,
|
||||
`semester` varchar(32) DEFAULT NULL,
|
||||
`sent_at` datetime NOT NULL DEFAULT current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `teacher_submission_notification_history`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_teacher_class` (`teacher_id`,`class_section_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `teacher_submission_notification_history`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('teacher_submission_notification_history');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `user_notifications` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`notification_id` int(11) NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`is_read` tinyint(1) DEFAULT 0,
|
||||
`delivered` tinyint(1) DEFAULT 0,
|
||||
`delivered_at` datetime DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `user_notifications`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `user_notifications`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `user_roles` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`user_id` int(11) UNSIGNED NOT NULL,
|
||||
`role_id` int(11) UNSIGNED NOT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`deleted_at` datetime DEFAULT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `user_roles`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `user_roles`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_roles');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `whatsapp_group_links` (
|
||||
`id` int(11) NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`class_section_name` varchar(255) NOT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`invite_link` text NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `whatsapp_group_links`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uq_section_term` (`class_section_id`,`school_year`,`semester`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `whatsapp_group_links`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('whatsapp_group_links');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `whatsapp_group_memberships` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`school_year` varchar(25) NOT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`subject_type` enum('primary','second') NOT NULL DEFAULT 'primary',
|
||||
`subject_id` int(11) NOT NULL COMMENT 'users.id for primary; parents.id for second',
|
||||
`is_member` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`verified_by` int(11) DEFAULT NULL,
|
||||
`verified_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `whatsapp_group_memberships`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_whatsapp_membership` (`class_section_id`,`school_year`,`semester`,`subject_type`,`subject_id`),
|
||||
ADD KEY `class_section_id_school_year_semester` (`class_section_id`,`school_year`,`semester`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `whatsapp_group_memberships`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('whatsapp_group_memberships');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `whatsapp_invites_log` (
|
||||
`id` int(11) NOT NULL,
|
||||
`parent_id` int(11) NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`link_id` int(11) DEFAULT NULL,
|
||||
`status` varchar(20) NOT NULL,
|
||||
`error_message` text DEFAULT NULL,
|
||||
`sent_at` datetime NOT NULL DEFAULT current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `whatsapp_invites_log`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `whatsapp_invites_log`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('whatsapp_invites_log');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `class_progress_reports` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) UNSIGNED NOT NULL,
|
||||
`teacher_id` int(11) UNSIGNED NOT NULL,
|
||||
`week_start` date NOT NULL,
|
||||
`week_end` date NOT NULL,
|
||||
`subject` varchar(160) DEFAULT NULL,
|
||||
`unit_title` varchar(120) DEFAULT NULL,
|
||||
`materials` varchar(160) DEFAULT NULL,
|
||||
`covered` text NOT NULL,
|
||||
`homework` text DEFAULT NULL,
|
||||
`assessment` text DEFAULT NULL,
|
||||
`status` varchar(20) NOT NULL,
|
||||
`status_notes` varchar(200) DEFAULT NULL,
|
||||
`class_notes` text DEFAULT NULL,
|
||||
`next_week_plan` text NOT NULL,
|
||||
`support_needed` text DEFAULT NULL,
|
||||
`flags_json` text DEFAULT NULL,
|
||||
`attachment_path` varchar(255) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_progress_reports`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_class_week` (`class_section_id`,`week_start`,`week_end`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_progress_reports`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('class_progress_reports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `class_progress_attachments` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`report_id` int(11) UNSIGNED NOT NULL,
|
||||
`file_path` varchar(255) NOT NULL,
|
||||
`original_name` varchar(255) DEFAULT NULL,
|
||||
`mime_type` varchar(120) DEFAULT NULL,
|
||||
`file_size` int(11) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_progress_attachments`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_report_id` (`report_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_progress_attachments`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_progress_attachments`
|
||||
ADD CONSTRAINT `fk_class_progress_attachments_report_id` FOREIGN KEY (`report_id`) REFERENCES `class_progress_reports` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('class_progress_attachments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `reimbursement_batch_items` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`batch_id` int(10) UNSIGNED NOT NULL,
|
||||
`expense_id` int(10) UNSIGNED NOT NULL,
|
||||
`reimbursement_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`admin_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`assigned_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`unassigned_at` datetime DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batch_items`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uq_batch_expense` (`batch_id`,`expense_id`),
|
||||
ADD KEY `idx_admin_id` (`admin_id`),
|
||||
ADD KEY `idx_batch` (`batch_id`),
|
||||
ADD KEY `fk_batch_items_expense` (`expense_id`),
|
||||
ADD KEY `fk_batch_items_reimbursement` (`reimbursement_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batch_items`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=133;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `reimbursement_batch_items`
|
||||
ADD CONSTRAINT `fk_batch_items_admin` FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
|
||||
ADD CONSTRAINT `fk_batch_items_batch` FOREIGN KEY (`batch_id`) REFERENCES `reimbursement_batches` (`id`) ON DELETE CASCADE,
|
||||
ADD CONSTRAINT `fk_batch_items_expense` FOREIGN KEY (`expense_id`) REFERENCES `expenses` (`id`) ON DELETE CASCADE,
|
||||
ADD CONSTRAINT `fk_batch_items_reimbursement` FOREIGN KEY (`reimbursement_id`) REFERENCES `reimbursements` (`id`) ON DELETE SET NULL;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('reimbursement_batch_items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `additional_charges` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`parent_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`invoice_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`school_year` varchar(20) NOT NULL,
|
||||
`semester` varchar(20) NOT NULL,
|
||||
`charge_type` enum('extra','previous') NOT NULL DEFAULT 'extra',
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`amount` decimal(10,2) NOT NULL,
|
||||
`due_date` date DEFAULT NULL,
|
||||
`status` enum('pending','applied','void') NOT NULL DEFAULT 'pending',
|
||||
`created_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `additional_charges`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_parent` (`parent_id`),
|
||||
ADD KEY `idx_invoice` (`invoice_id`),
|
||||
ADD KEY `idx_term` (`school_year`,`semester`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `additional_charges`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('additional_charges');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `admin_notification_subjects` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`admin_id` int(11) UNSIGNED NOT NULL,
|
||||
`subject` varchar(100) NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `admin_notification_subjects`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_admin_subject` (`admin_id`,`subject`),
|
||||
ADD KEY `admin_id` (`admin_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `admin_notification_subjects`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('admin_notification_subjects');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `attendance_comment_template` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`min_score` decimal(5,2) NOT NULL,
|
||||
`max_score` decimal(5,2) NOT NULL,
|
||||
`template_text` text NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_comment_template`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_min_max_score` (`min_score`,`max_score`),
|
||||
ADD KEY `idx_is_active` (`is_active`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_comment_template`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_comment_template');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `attendance_data` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_id` int(11) NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`date` date NOT NULL,
|
||||
`status` enum('present','absent','late') NOT NULL DEFAULT 'present',
|
||||
`reason` text DEFAULT NULL,
|
||||
`is_reported` enum('no','yes') DEFAULT 'no',
|
||||
`is_notified` enum('no','yes') NOT NULL DEFAULT 'no',
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`modified_by` int(11) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_data`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_data`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_data');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `attendance_day` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`date` date NOT NULL,
|
||||
`status` enum('draft','submitted','published') NOT NULL DEFAULT 'draft',
|
||||
`submitted_by` int(11) DEFAULT NULL,
|
||||
`submitted_at` datetime DEFAULT NULL,
|
||||
`published_by` int(11) DEFAULT NULL,
|
||||
`published_at` datetime DEFAULT NULL,
|
||||
`auto_publish_at` datetime DEFAULT NULL,
|
||||
`reopened_by` int(11) DEFAULT NULL,
|
||||
`reopened_at` datetime DEFAULT NULL,
|
||||
`reopen_reason` varchar(255) DEFAULT NULL,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_day`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_section_date_term` (`class_section_id`,`date`,`semester`,`school_year`),
|
||||
ADD KEY `idx_status_autopublish` (`status`,`auto_publish_at`),
|
||||
ADD KEY `idx_term` (`semester`,`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_day`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_day');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `attendance_record` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`school_id` char(36) NOT NULL,
|
||||
`total_absence` int(11) NOT NULL DEFAULT 0,
|
||||
`total_late` int(11) NOT NULL DEFAULT 0,
|
||||
`total_presence` int(11) NOT NULL DEFAULT 0,
|
||||
`total_attendance` int(11) NOT NULL DEFAULT 0,
|
||||
`semester` varchar(25) NOT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`modified_by` int(11) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_record`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `idx_student_id` (`student_id`),
|
||||
ADD KEY `idx_class_section_id` (`class_section_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_record`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_record');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `attendance_tracking` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`date` datetime NOT NULL,
|
||||
`is_reported` enum('no','yes') NOT NULL DEFAULT 'no',
|
||||
`reason` text DEFAULT NULL,
|
||||
`note` text DEFAULT NULL,
|
||||
`is_notified` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`notif_counter` int(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`semester` varchar(16) DEFAULT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_tracking`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `student_id` (`student_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_tracking`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `attendance_tracking`
|
||||
ADD CONSTRAINT `attendance_tracking_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_tracking');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `authorized_users` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`authorized_user_id` int(11) DEFAULT NULL,
|
||||
`firstname` varchar(255) NOT NULL,
|
||||
`lastname` varchar(255) NOT NULL,
|
||||
`phone_number` varchar(25) NOT NULL,
|
||||
`gender` varchar(10) NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`relation_to_user` varchar(64) DEFAULT NULL,
|
||||
`token` varchar(128) DEFAULT NULL,
|
||||
`status` enum('Pending','Active') DEFAULT 'Pending',
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `authorized_users`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `authorized_users`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('authorized_users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `badge_print_logs` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`printed_by` int(11) DEFAULT NULL,
|
||||
`school_year` varchar(32) DEFAULT NULL,
|
||||
`printed_at` datetime NOT NULL,
|
||||
`role` varchar(128) DEFAULT NULL,
|
||||
`class_section_name` varchar(191) DEFAULT NULL,
|
||||
`copies` int(11) NOT NULL DEFAULT 1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `badge_print_logs`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `user_id` (`user_id`),
|
||||
ADD KEY `school_year` (`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `badge_print_logs`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('badge_print_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `calendar_events` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`date` date NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`notify_parent` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`notify_admin` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`notify_teacher` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`no_school` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`notification_sent` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `calendar_events`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `calendar_events`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('calendar_events');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `chapters` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`chapter_name` varchar(100) NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`school_year` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `chapters`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `chapters`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('chapters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `classSection` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_name` varchar(100) NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `classSection`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `classSection`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('classSection');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `class_prep_adjustments` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section_id` varchar(32) NOT NULL,
|
||||
`item_name` varchar(128) NOT NULL,
|
||||
`adjustment` int(11) NOT NULL DEFAULT 0,
|
||||
`adjustable` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`school_year` varchar(16) NOT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_prep_adjustments`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_prep_adjustments`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('class_prep_adjustments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `class_preparation_log` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section` varchar(100) DEFAULT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`prep_data` text NOT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_preparation_log`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `class_preparation_log`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('class_preparation_log');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `classes` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`class_name` varchar(100) NOT NULL,
|
||||
`schedule` varchar(100) NOT NULL,
|
||||
`capacity` int(11) NOT NULL,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `classes`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `classes`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('classes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `competition_class_winners` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`competition_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) NOT NULL,
|
||||
`winners_override` int(11) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`question_count` int(11) DEFAULT NULL,
|
||||
`prize_1` decimal(10,2) DEFAULT NULL,
|
||||
`prize_2` decimal(10,2) DEFAULT NULL,
|
||||
`prize_3` decimal(10,2) DEFAULT NULL,
|
||||
`prize_4` decimal(10,2) DEFAULT NULL,
|
||||
`prize_5` decimal(10,2) DEFAULT NULL,
|
||||
`prize_6` decimal(10,2) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competition_class_winners`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `competition_id_class_section_id` (`competition_id`,`class_section_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competition_class_winners`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('competition_class_winners');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `competition_scores` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`competition_id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`score` decimal(6,2) NOT NULL DEFAULT 0.00,
|
||||
`notes` varchar(255) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competition_scores`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `competition_id_student_id_class_section_id` (`competition_id`,`student_id`,`class_section_id`),
|
||||
ADD KEY `competition_id` (`competition_id`),
|
||||
ADD KEY `student_id` (`student_id`),
|
||||
ADD KEY `class_section_id` (`class_section_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competition_scores`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('competition_scores');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `competition_winners` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`competition_id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`rank` int(11) NOT NULL,
|
||||
`score` decimal(6,2) NOT NULL DEFAULT 0.00,
|
||||
`prize_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`created_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competition_winners`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `competition_id_class_section_id_student_id` (`competition_id`,`class_section_id`,`student_id`),
|
||||
ADD KEY `competition_id` (`competition_id`),
|
||||
ADD KEY `class_section_id` (`class_section_id`),
|
||||
ADD KEY `competition_id_class_section_id_rank` (`competition_id`,`class_section_id`,`rank`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competition_winners`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('competition_winners');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `competitions` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`title` varchar(150) NOT NULL,
|
||||
`semester` varchar(30) DEFAULT NULL,
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`class_section_id` int(11) DEFAULT NULL,
|
||||
`start_date` date DEFAULT NULL,
|
||||
`end_date` date DEFAULT NULL,
|
||||
`winners_count` int(11) NOT NULL DEFAULT 3,
|
||||
`prize_per_point` decimal(10,2) NOT NULL DEFAULT 1.00,
|
||||
`is_published` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`published_at` datetime DEFAULT NULL,
|
||||
`created_by` int(11) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`deleted_at` datetime DEFAULT NULL,
|
||||
`is_locked` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`locked_at` datetime DEFAULT NULL,
|
||||
`locked_by` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competitions`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `class_section_id` (`class_section_id`),
|
||||
ADD KEY `is_published` (`is_published`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `competitions`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('competitions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `configuration` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`config_key` varchar(100) NOT NULL,
|
||||
`config_value` varchar(100) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `configuration`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `configuration`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('configuration');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `contactus` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`sender_id` int(11) UNSIGNED NOT NULL,
|
||||
`reciever_id` int(11) UNSIGNED NOT NULL,
|
||||
`subject` varchar(255) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `contactus`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `contactus`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contactus');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `current_flag` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`student_id` int(11) NOT NULL,
|
||||
`student_name` varchar(255) NOT NULL,
|
||||
`grade` varchar(50) NOT NULL,
|
||||
`flag` enum('payment','attendance','grade','behavior','talking_off_task','calling_out','minor_disruption','minor_dress_code','forgetting_materials','repeated_defiance','disrespectful_tone','minor_profanity','repeated_tardiness','device_misuse','minor_conflict','bullying_harassment','fighting_aggression','threats','theft','vandalism','sexual_harassment','serious_cyber_incident','contraband','weapons_drugs','other') NOT NULL,
|
||||
`flag_datetime` datetime NOT NULL,
|
||||
`flag_state` enum('Open','Closed','Canceled') DEFAULT 'Open',
|
||||
`updated_by_open` int(11) DEFAULT NULL,
|
||||
`open_description` text DEFAULT NULL,
|
||||
`updated_by_closed` int(11) DEFAULT NULL,
|
||||
`close_description` text DEFAULT NULL,
|
||||
`action_taken` text DEFAULT NULL,
|
||||
`updated_by_canceled` int(11) DEFAULT NULL,
|
||||
`cancel_description` text DEFAULT NULL,
|
||||
`semester` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`school_year` varchar(9) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `current_flag`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `current_flag`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('current_flag');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `discount_usages` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`voucher_id` int(11) NOT NULL,
|
||||
`invoice_id` int(11) UNSIGNED NOT NULL,
|
||||
`parent_id` int(11) DEFAULT NULL,
|
||||
`discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
|
||||
`description` text DEFAULT NULL,
|
||||
`school_year` varchar(9) NOT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL,
|
||||
`used_at` datetime DEFAULT current_timestamp(),
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp(),
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `discount_usages`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `discount_usages`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('discount_usages');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `discount_vouchers` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`code` varchar(50) NOT NULL,
|
||||
`discount_type` enum('percent','fixed') NOT NULL DEFAULT 'percent',
|
||||
`description` text DEFAULT NULL,
|
||||
`discount_value` decimal(10,2) NOT NULL,
|
||||
`max_uses` int(11) DEFAULT 1,
|
||||
`times_used` int(11) DEFAULT 0,
|
||||
`valid_from` date DEFAULT NULL,
|
||||
`valid_until` date DEFAULT NULL,
|
||||
`is_active` tinyint(1) DEFAULT 1,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`school_year` varchar(20) DEFAULT NULL,
|
||||
`semester` varchar(10) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `discount_vouchers`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `discount_vouchers`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('discount_vouchers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `early_dismissal_signatures` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`report_date` date NOT NULL,
|
||||
`school_year` varchar(16) DEFAULT NULL,
|
||||
`semester` varchar(32) DEFAULT NULL,
|
||||
`filename` varchar(255) NOT NULL,
|
||||
`original_name` varchar(255) DEFAULT NULL,
|
||||
`mime_type` varchar(128) DEFAULT NULL,
|
||||
`file_size` int(10) UNSIGNED DEFAULT NULL,
|
||||
`uploaded_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `early_dismissal_signatures`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_early_dismissal_signature` (`report_date`,`school_year`,`semester`),
|
||||
ADD KEY `report_date` (`report_date`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `early_dismissal_signatures`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('early_dismissal_signatures');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `email_templates` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`code` varchar(32) NOT NULL,
|
||||
`variant` enum('default','answered','no_answer') NOT NULL DEFAULT 'default',
|
||||
`subject` varchar(255) NOT NULL,
|
||||
`body_html` mediumtext NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`updated_by` int(10) UNSIGNED DEFAULT NULL,
|
||||
`updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `email_templates`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `uniq_code_variant` (`code`,`variant`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `email_templates`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('email_templates');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `emergency_contacts` (
|
||||
`id` int(11) UNSIGNED NOT NULL,
|
||||
`emergency_contact_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`parent_id` int(11) DEFAULT NULL,
|
||||
`cellphone` varchar(20) NOT NULL,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`relation` varchar(50) NOT NULL,
|
||||
`semester` varchar(255) NOT NULL,
|
||||
`school_year` varchar(9) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `emergency_contacts`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `emergency_contacts`
|
||||
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('emergency_contacts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<'SQL'
|
||||
CREATE TABLE `enrollments` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`student_id` int(10) UNSIGNED NOT NULL,
|
||||
`class_section_id` int(10) UNSIGNED DEFAULT NULL,
|
||||
`parent_id` int(10) UNSIGNED NOT NULL,
|
||||
`enrollment_date` date NOT NULL,
|
||||
`enrollment_status` enum('admission under review','payment pending','enrolled','withdraw under review','refund pending','withdrawn','waitlist','denied') NOT NULL DEFAULT 'admission under review',
|
||||
`withdrawal_date` date DEFAULT NULL,
|
||||
`is_withdrawn` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`admission_status` enum('pending','accepted','denied') NOT NULL DEFAULT 'pending',
|
||||
`semester` varchar(25) DEFAULT NULL,
|
||||
`school_year` varchar(25) NOT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `enrollments`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `student_id` (`student_id`),
|
||||
ADD KEY `class_section_id` (`class_section_id`),
|
||||
ADD KEY `parent_id` (`parent_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
ALTER TABLE `enrollments`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('enrollments');
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user