Files
speedBB/database/migrations/2025_12_26_161933_create_settings_table.php

50 lines
1.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('key', 100)->unique();
$table->text('value');
$table->timestamps();
});
Schema::table('settings', function (Blueprint $table) {
$table->index('key', 'idx_settings_key');
});
DB::table('settings')->insert([
[
'key' => 'version',
'value' => '25.00.1',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'build',
'value' => '3',
'created_at' => now(),
'updated_at' => now(),
],
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};