You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2023_09_03_032820_create_currencies_table.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('currencies', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  15. $table->string('name', 50);
  16. $table->string('code')->index();
  17. $table->bigInteger('rate')->default(1);
  18. $table->unsignedTinyInteger('precision')->default(2);
  19. $table->string('symbol')->default('$');
  20. $table->boolean('symbol_first')->default(true);
  21. $table->string('decimal_mark')->default('.');
  22. $table->string('thousands_separator')->default(',');
  23. $table->boolean('enabled')->default(true);
  24. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  25. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  26. $table->timestamps();
  27. $table->unique(['company_id', 'code']);
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. */
  33. public function down(): void
  34. {
  35. Schema::dropIfExists('currencies');
  36. }
  37. };