generated from Flycro/laravel-nuxt
feat: Migrations for various Systems
This commit is contained in:
@@ -21,6 +21,7 @@ return new class extends Migration
|
|||||||
$table->string('cover_image')->nullable();
|
$table->string('cover_image')->nullable();
|
||||||
$table->unsignedBigInteger('recommended_by');
|
$table->unsignedBigInteger('recommended_by');
|
||||||
$table->enum('status', ['PENDING', 'COMPLETED', 'REJECTED','ACTIVE'])->default('PENDING');
|
$table->enum('status', ['PENDING', 'COMPLETED', 'REJECTED','ACTIVE'])->default('PENDING');
|
||||||
|
$table->dateTime('published_at')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->foreign('recommended_by')->references('id')->on('users')->onDelete('cascade');
|
$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');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user