32 lines
874 B
PHP
32 lines
874 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('units', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('name', 50)->unique();
|
|
$table->string('symbol', 10)->nullable();
|
|
$table->timestamps();
|
|
});
|
|
|
|
// Füge Standard-Einheiten hinzu
|
|
DB::table('units')->insert([
|
|
['name' => 'Stück', 'symbol' => 'Stk'],
|
|
['name' => 'Stunden', 'symbol' => 'h'],
|
|
['name' => 'Tage', 'symbol' => 'd'],
|
|
['name' => 'pauschal', 'symbol' => 'p'],
|
|
]);
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('units');
|
|
}
|
|
}; |