login update
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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('stories_authors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('name', 255);
|
||||
$table->string('avatar', 500)->nullable();
|
||||
$table->text('bio')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stories_authors');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('stories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->string('title', 255);
|
||||
$table->text('excerpt')->nullable();
|
||||
$table->longText('content')->nullable();
|
||||
$table->string('cover_image', 500)->nullable();
|
||||
$table->foreignId('author_id')->nullable()
|
||||
->constrained('stories_authors')->nullOnDelete();
|
||||
$table->unsignedInteger('views')->default(0);
|
||||
$table->boolean('featured')->default(false);
|
||||
$table->enum('status', ['draft', 'published'])->default('draft');
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->unsignedBigInteger('legacy_interview_id')->nullable()->unique()->comment('Original ID from legacy interviews table');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('published_at');
|
||||
$table->index('featured');
|
||||
$table->index('views');
|
||||
$table->index(['status', 'published_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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('stories_tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->string('name', 255);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stories_tags');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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('stories_tag_relation', function (Blueprint $table) {
|
||||
$table->foreignId('story_id')->constrained('stories')->cascadeOnDelete();
|
||||
$table->foreignId('tag_id')->constrained('stories_tags')->cascadeOnDelete();
|
||||
$table->primary(['story_id', 'tag_id']);
|
||||
|
||||
$table->index('story_id');
|
||||
$table->index('tag_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stories_tag_relation');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('social_accounts', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->string('provider', 50);
|
||||
$table->string('provider_id', 255);
|
||||
$table->string('provider_email', 255)->nullable();
|
||||
$table->string('avatar', 500)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->index('user_id');
|
||||
$table->index('provider');
|
||||
$table->index('provider_id');
|
||||
$table->unique(['provider', 'provider_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('social_accounts');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user