123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?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('transactions', function (Blueprint $table) {
- $table->id();
- $table->foreignId('company_id')->constrained()->cascadeOnDelete();
- $table->foreignId('account_id')->nullable()->constrained()->nullOnDelete();
- $table->foreignId('bank_account_id')->nullable()->constrained()->nullOnDelete();
- $table->foreignId('contact_id')->nullable()->constrained()->nullOnDelete();
- $table->string('type'); // deposit, withdrawal, journal
- $table->string('payment_channel')->nullable(); // online, in store, other
- $table->string('description')->nullable();
- $table->text('notes')->nullable();
- $table->string('reference')->nullable();
- $table->bigInteger('amount')->default(0);
- $table->boolean('pending')->default(false);
- $table->boolean('reviewed')->default(false);
- $table->dateTime('posted_at');
- $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
- $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('transactions');
- }
- };
|