37 lines
1.6 KiB
PHP
37 lines
1.6 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('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');
|
||
}
|
||
};
|