| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?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('announcements', function (Blueprint $table) {
- $table->engine = 'InnoDB';
- $table->id();
- $table->string('category', 16);
- $table->json('publish_platforms');
- $table->string('display_frequency', 24)->default('daily_first_login');
- $table->dateTime('publish_at');
- $table->dateTime('end_at')->nullable();
- $table->unsignedTinyInteger('status')->default(1);
- $table->string('click_type', 16)->default('none');
- $table->string('link', 2048)->nullable();
- $table->unsignedBigInteger('activity_id')->nullable();
- $table->unsignedBigInteger('sender_id');
- $table->string('sender_name', 100);
- $table->timestamps();
- $table->index(['status', 'publish_at'], 'announcement_publication');
- $table->index('end_at');
- });
- Schema::create('announcement_translations', function (Blueprint $table) {
- $table->engine = 'InnoDB'; $table->id(); $table->unsignedBigInteger('announcement_id');
- $table->string('language', 8); $table->string('title', 200); $table->mediumText('content');
- $table->unique(['announcement_id', 'language'], 'announcement_translation');
- });
- }
- public function down(): void
- {
- Schema::dropIfExists('announcement_translations'); Schema::dropIfExists('announcements');
- }
- };
|