Add an editable menu name and reserve billing material numbers on creation

- Company details get an optional "Valikon nimi", shown at the left of the
  main menu; it falls back to the application name when empty.
- A billing material gets its running number (billing_exports.number) only
  when it is created, so discarded drafts leave no gaps. Drafts have no
  number; existing created materials are numbered by the migration, and the
  CSV file name uses the number.
- TaskAssigneeMigrationTest rolls back from its own migration onward instead
  of assuming it is the last one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-24 19:41:57 +02:00
co-authored by Claude Sonnet 5.5
parent 48030e7689
commit 7d7b72989d
25 changed files with 195 additions and 23 deletions
@@ -0,0 +1,35 @@
<?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
{
/**
* The number of a billing material is reserved when it is created, not when
* the draft is started, so discarded drafts leave no gaps. Created
* materials get 1, 2, ... in the order they were started; drafts have none.
*/
public function up(): void
{
Schema::table('billing_exports', function (Blueprint $table) {
$table->unsignedInteger('number')->nullable()->unique()->after('id');
});
$number = 0;
foreach (DB::table('billing_exports')->where('status', '!=', 'draft')->orderBy('id')->pluck('id') as $id) {
DB::table('billing_exports')->where('id', $id)->update(['number' => ++$number]);
}
}
public function down(): void
{
Schema::table('billing_exports', function (Blueprint $table) {
$table->dropUnique(['number']);
$table->dropColumn('number');
});
}
};