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_05_10_040940_create_currencies_table.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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', 100);
  16. $table->string('code')->index();
  17. $table->decimal('rate', 15, 8);
  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->timestamps();
  26. $table->unique(['company_id', 'code']);
  27. });
  28. }
  29. /**
  30. * Reverse the migrations.
  31. */
  32. public function down(): void
  33. {
  34. Schema::dropIfExists('currencies');
  35. }
  36. };