chore: commit remaining workspace changes
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->longText('content_markdown')->nullable()->after('content');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->dropColumn('content_markdown');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->unsignedInteger('lesson_number')->nullable()->after('slug');
|
||||
$table->unsignedInteger('course_order')->nullable()->after('lesson_number');
|
||||
$table->string('series_name', 120)->nullable()->after('course_order');
|
||||
|
||||
$table->index(['series_name', 'course_order', 'lesson_number'], 'academy_lessons_series_course_order_index');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->dropIndex('academy_lessons_series_course_order_index');
|
||||
$table->dropColumn(['lesson_number', 'course_order', 'series_name']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->string('article_cover_image')->nullable()->after('cover_image');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->dropColumn('article_cover_image');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->json('tags')->nullable()->after('article_cover_image');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('academy_lessons', function (Blueprint $table): void {
|
||||
$table->dropColumn('tags');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('academy_courses', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('slug')->unique();
|
||||
$table->string('subtitle')->nullable();
|
||||
$table->text('excerpt')->nullable();
|
||||
$table->longText('description')->nullable();
|
||||
$table->string('cover_image')->nullable();
|
||||
$table->string('teaser_image')->nullable();
|
||||
$table->string('access_level')->default('free');
|
||||
$table->string('difficulty')->default('beginner');
|
||||
$table->string('status')->default('draft');
|
||||
$table->boolean('is_featured')->default(false);
|
||||
$table->unsignedInteger('order_num')->default(0);
|
||||
$table->unsignedInteger('estimated_minutes')->nullable();
|
||||
$table->unsignedInteger('lessons_count_cache')->default(0);
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->string('seo_title')->nullable();
|
||||
$table->text('seo_description')->nullable();
|
||||
$table->text('meta_keywords')->nullable();
|
||||
$table->string('og_title')->nullable();
|
||||
$table->text('og_description')->nullable();
|
||||
$table->string('og_image')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['status', 'published_at']);
|
||||
$table->index(['is_featured', 'order_num']);
|
||||
$table->index(['access_level', 'difficulty']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('academy_courses');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('academy_course_sections', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('course_id')->constrained('academy_courses')->cascadeOnDelete();
|
||||
$table->string('title');
|
||||
$table->string('slug')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedInteger('order_num')->default(0);
|
||||
$table->boolean('is_visible')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['course_id', 'order_num']);
|
||||
$table->unique(['course_id', 'slug']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('academy_course_sections');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('academy_course_lessons', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('course_id')->constrained('academy_courses')->cascadeOnDelete();
|
||||
$table->foreignId('section_id')->nullable()->constrained('academy_course_sections')->nullOnDelete();
|
||||
$table->foreignId('lesson_id')->constrained('academy_lessons')->cascadeOnDelete();
|
||||
$table->unsignedInteger('order_num')->default(0);
|
||||
$table->boolean('is_required')->default(true);
|
||||
$table->string('access_override')->nullable();
|
||||
$table->foreignId('unlock_after_lesson_id')->nullable()->constrained('academy_lessons')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['course_id', 'lesson_id']);
|
||||
$table->index(['course_id', 'section_id', 'order_num']);
|
||||
$table->index(['lesson_id']);
|
||||
$table->index(['is_required']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('academy_course_lessons');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('academy_course_enrollments', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('course_id')->constrained('academy_courses')->cascadeOnDelete();
|
||||
$table->string('status')->default('active');
|
||||
$table->foreignId('last_lesson_id')->nullable()->constrained('academy_lessons')->nullOnDelete();
|
||||
$table->timestamp('started_at')->nullable();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'course_id']);
|
||||
$table->index(['course_id', 'status']);
|
||||
$table->index(['user_id', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('academy_course_enrollments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('academy_lesson_revisions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('lesson_id')->constrained('academy_lessons')->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('change_note', 255)->nullable();
|
||||
$table->json('snapshot_json');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['lesson_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('academy_lesson_revisions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user