38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?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('posts', function (Blueprint $table) {
|
|
$table->string('id', 64)->primary();
|
|
$table->string('code', 64)->nullable();
|
|
$table->string('username')->nullable();
|
|
$table->string('full_name')->nullable();
|
|
$table->text('caption')->nullable();
|
|
$table->text('accessibility_caption')->nullable();
|
|
$table->boolean('is_video')->default(false);
|
|
$table->boolean('is_carousel')->default(false);
|
|
$table->integer('like_count')->nullable();
|
|
$table->integer('comment_count')->nullable();
|
|
$table->bigInteger('taken_at')->nullable(); // unix timestamp from IG
|
|
$table->text('image_url')->nullable();
|
|
$table->text('video_url')->nullable();
|
|
$table->jsonb('carousel_images')->nullable();
|
|
$table->timestamp('scraped_at')->useCurrent();
|
|
$table->text('profile_pic_url')->nullable();
|
|
$table->index('username');
|
|
$table->index('taken_at');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('posts');
|
|
}
|
|
};
|