您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2023_10_11_210415_create_localizations_table.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use App\Enums\DateFormat;
  3. use App\Enums\NumberFormat;
  4. use App\Enums\TimeFormat;
  5. use App\Enums\WeekStart;
  6. use Illuminate\Database\Migrations\Migration;
  7. use Illuminate\Database\Schema\Blueprint;
  8. use Illuminate\Support\Facades\Schema;
  9. return new class extends Migration
  10. {
  11. /**
  12. * Run the migrations.
  13. */
  14. public function up(): void
  15. {
  16. Schema::create('localizations', function (Blueprint $table) {
  17. $table->id();
  18. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  19. $table->string('language')->default('en');
  20. $table->string('timezone')->nullable();
  21. $table->string('date_format')->default(DateFormat::DEFAULT);
  22. $table->string('time_format')->default(TimeFormat::DEFAULT);
  23. $table->date('fiscal_year_start')->default(now()->startOfYear()->toDateString());
  24. $table->date('fiscal_year_end')->default(now()->endOfYear()->toDateString());
  25. $table->unsignedTinyInteger('week_start')->default(WeekStart::DEFAULT);
  26. $table->string('number_format')->default(NumberFormat::DEFAULT);
  27. $table->boolean('percent_first')->default(false);
  28. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  29. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  30. $table->timestamps();
  31. });
  32. }
  33. /**
  34. * Reverse the migrations.
  35. */
  36. public function down(): void
  37. {
  38. Schema::dropIfExists('localizations');
  39. }
  40. };