12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
-
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
-
- return new class extends Migration
- {
- /**
- * Run the migrations.
- */
- public function up(): void
- {
- Schema::create('currencies', function (Blueprint $table) {
- $table->id();
- $table->foreignId('company_id')->constrained()->cascadeOnDelete();
- $table->string('name', 100);
- $table->string('code')->index();
- $table->decimal('rate', 15, 8);
- $table->unsignedTinyInteger('precision')->default(2);
- $table->string('symbol')->default('$');
- $table->boolean('symbol_first')->default(true);
- $table->string('decimal_mark')->default('.');
- $table->string('thousands_separator')->default(',');
- $table->boolean('enabled')->default(true);
- $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
- $table->timestamps();
-
- $table->unique(['company_id', 'code']);
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('currencies');
- }
- };
|