generated from Flycro/laravel-nuxt
feat: Migrations for various Systems
parent
12d8f3913c
commit
daa80f4ff3
|
|
@ -21,6 +21,7 @@ return new class extends Migration
|
|||
$table->string('cover_image')->nullable();
|
||||
$table->unsignedBigInteger('recommended_by');
|
||||
$table->enum('status', ['PENDING', 'COMPLETED', 'REJECTED','ACTIVE'])->default('PENDING');
|
||||
$table->dateTime('published_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('recommended_by')->references('id')->on('users')->onDelete('cascade');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('deadlines', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('book_recommendation_id')->constrained()->onDelete('cascade');
|
||||
$table->date('deadline');
|
||||
$table->unsignedInteger('target_page')->nullable();
|
||||
$table->string('target_chapter')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('deadlines');
|
||||
}
|
||||
};
|
||||
|
|
@ -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
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_deadlines', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('deadline_id')->constrained('deadlines')->onDelete('cascade');
|
||||
$table->dateTime('completed_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_deadlines');
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue