Zahlungszwecke
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Der Zahlungsgrund als eigene Angabe: die Spalte "Zahlungsgrund" der Beleglisten und der "Zweck" der
|
||||
* EüR-Anlage. Bislang wurde er aus `type_other` bzw. Reisegrund und Kontaktname abgeleitet -- damit war
|
||||
* er weder erfassbar noch korrigierbar.
|
||||
*
|
||||
* Kein Backfill: `null` heißt "ableiten wie bisher", und genau das brauchen die Bestandsbelege.
|
||||
*/
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
$table->string('purpose')->nullable()->default(null)->after('type_other');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Gründe für eine Reisekostenabrechnung.
|
||||
*
|
||||
* Vorher ein Freitextfeld: Jede Fahrt hieß anders, und auswerten ließ sich nichts. Aufgebaut wie
|
||||
* {@see \App\Enumerations\RetentionReason}: app-weite Stammdaten, `slug` als Schlüssel, `requires_note`
|
||||
* für den einen Grund, der ohne Erläuterung nichts aussagt.
|
||||
*
|
||||
* `invoices.travel_reason` bekommt bewusst keinen Fremdschlüssel: Bei "Anderer Grund" steht dort der
|
||||
* Text und nicht der Schlüssel -- der Schlüssel `other` sagt für sich nichts aus. Dieselbe Spalte führt
|
||||
* damit weiter den Freitext der Bestandsbelege, ohne dass etwas umgeschrieben werden muss.
|
||||
*/
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('travel_reasons', function (Blueprint $table) {
|
||||
$table->string('slug')->primary();
|
||||
$table->string('name');
|
||||
$table->boolean('requires_note')->default(false);
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
DB::table('travel_reasons')->insert([
|
||||
[
|
||||
'slug' => 'event_travel',
|
||||
'name' => 'An-/Abreise zur Veranstaltung',
|
||||
'requires_note' => false,
|
||||
'sort_order' => 10,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'slug' => 'material_transport',
|
||||
'name' => 'Materialtransport',
|
||||
'requires_note' => false,
|
||||
'sort_order' => 20,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'slug' => 'purchase',
|
||||
'name' => 'Einkauf',
|
||||
'requires_note' => false,
|
||||
'sort_order' => 30,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'slug' => 'other',
|
||||
'name' => 'Anderer Grund',
|
||||
'requires_note' => true,
|
||||
'sort_order' => 40,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('travel_reasons');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user