Files
animexe/database/migrations/2026_07_07_000001_create_ads_table.php
2026-07-14 00:01:48 +03:00

37 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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('ads', function (Blueprint $table) {
$table->id();
$table->string('name', 120); // Admin içi tanımlayıcı isim
$table->enum('type', ['video', 'banner'])->default('video');
$table->string('placement', 30)->default('preroll'); // preroll | home_mid | home_bottom
$table->string('file_path')->nullable(); // Yüklenen dosya (storage/public)
$table->text('external_url')->nullable(); // Dış URL (mp4 veya görsel)
$table->text('click_url')->nullable(); // Tıklama hedefi
$table->unsignedSmallInteger('skip_after')->default(5); // Video: kaç sn sonra geçilebilir
$table->unsignedSmallInteger('weight')->default(10); // Rotasyon ağırlığı (yüksek = sık)
$table->boolean('is_active')->default(true);
$table->timestamp('starts_at')->nullable(); // Zamanlama (opsiyonel)
$table->timestamp('ends_at')->nullable();
$table->unsignedBigInteger('impressions')->default(0);
$table->unsignedBigInteger('clicks')->default(0);
$table->timestamps();
$table->index(['type', 'is_active']);
$table->index('placement');
});
}
public function down(): void
{
Schema::dropIfExists('ads');
}
};