36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Hypervel\Database\Migrations\Migration;
|
|
use Hyperf\Database\Schema\Blueprint;
|
|
use Hypervel\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('announcements', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('title');
|
|
$table->text('content');
|
|
$table->string('type')->default('info'); // info, success, warning, danger
|
|
$table->boolean('is_active')->default(true);
|
|
$table->timestamp('starts_at')->nullable();
|
|
$table->timestamp('ends_at')->nullable();
|
|
$table->unsignedBigInteger('created_by')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->foreign('created_by')->references('id')->on('users')->onDelete('set null');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('announcements');
|
|
}
|
|
};
|