fix exam and grading
This commit is contained in:
@@ -11,30 +11,9 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
// This project has authoritative legacy-schema migrations for users,
|
||||
// password reset tables, and sessions. Keep the starter migration inert
|
||||
// so migrate:fresh follows the provided school_api schema instead.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,8 +21,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
// No-op: the dump-aligned migrations own these tables.
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,17 +11,8 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
// The dump-aligned cache migration runs later with the exact schema and
|
||||
// indexes from school_api.sql. Leave this starter migration inert.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +20,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
// No-op: the dump-aligned migration owns these tables.
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,38 +11,8 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
// school_api.sql does not define Laravel queue tables. Keep this starter
|
||||
// migration inert so fresh migrations stay aligned with the provided dump.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,8 +20,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
// No-op: this migration does not create any tables.
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('certificate_records')) {
|
||||
return;
|
||||
}
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
CREATE TABLE `certificate_records` (
|
||||
`id` int UNSIGNED NOT NULL,
|
||||
`certificate_number` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`student_id` int UNSIGNED NOT NULL,
|
||||
`student_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`grade` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`cert_date` date DEFAULT NULL,
|
||||
`school_year` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`class_section_id` int UNSIGNED DEFAULT NULL,
|
||||
`issued_by` int UNSIGNED DEFAULT NULL,
|
||||
`issued_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `certificate_records`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `certificate_number` (`certificate_number`),
|
||||
ADD KEY `idx_school_year_student` (`school_year`,`student_id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `certificate_records`
|
||||
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('certificate_records');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('flag')) {
|
||||
return;
|
||||
}
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
CREATE TABLE `flag` (
|
||||
`id` int UNSIGNED NOT NULL,
|
||||
`student_id` int NOT NULL,
|
||||
`student_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`grade` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`incident` 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') COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`incident_datetime` datetime NOT NULL,
|
||||
`incident_state` enum('Open','Closed','Canceled') COLLATE utf8mb4_general_ci DEFAULT 'Open',
|
||||
`updated_by_open` int DEFAULT NULL,
|
||||
`open_description` text COLLATE utf8mb4_general_ci,
|
||||
`updated_by_closed` int DEFAULT NULL,
|
||||
`close_description` text COLLATE utf8mb4_general_ci,
|
||||
`action_taken` text COLLATE utf8mb4_general_ci,
|
||||
`updated_by_canceled` int DEFAULT NULL,
|
||||
`cancel_description` text COLLATE utf8mb4_general_ci,
|
||||
`semester` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
|
||||
`school_year` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_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
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `flag`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `flag`
|
||||
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flag');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('below_sixty_decisions')) {
|
||||
return;
|
||||
}
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
CREATE TABLE `below_sixty_decisions` (
|
||||
`id` int unsigned NOT NULL,
|
||||
`student_id` int unsigned NOT NULL,
|
||||
`semester` varchar(20) COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`school_year` varchar(20) COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`decision` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`notes` text COLLATE utf8mb4_general_ci,
|
||||
`decided_by` int unsigned DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `below_sixty_decisions`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `student_id_semester_school_year` (`student_id`,`semester`,`school_year`),
|
||||
ADD KEY `school_year_semester` (`school_year`,`semester`);
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `below_sixty_decisions`
|
||||
MODIFY `id` int unsigned NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('below_sixty_decisions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('student_decisions')) {
|
||||
return;
|
||||
}
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
CREATE TABLE `student_decisions` (
|
||||
`id` int unsigned NOT NULL,
|
||||
`student_id` int unsigned NOT NULL,
|
||||
`school_year` varchar(20) COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`class_section_name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`year_score` decimal(6,2) DEFAULT NULL,
|
||||
`decision` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`source` enum('auto','manual','pending') COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'auto',
|
||||
`notes` text COLLATE utf8mb4_general_ci,
|
||||
`generated_by` int unsigned DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `student_decisions`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `student_id_semester_school_year` (`student_id`,`school_year`),
|
||||
ADD KEY `school_year_semester` (`school_year`);
|
||||
SQL
|
||||
);
|
||||
|
||||
App\Support\SqliteCompat::statement(<<<'SQL'
|
||||
ALTER TABLE `student_decisions`
|
||||
MODIFY `id` int unsigned NOT NULL AUTO_INCREMENT;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('student_decisions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user