Initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?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('budget_item_id')->nullable()->constrained()->nullOnDelete()->comment('Budget item reference');
|
||||
$table->foreignId('chart_of_account_id')->constrained()->cascadeOnDelete()->comment('Chart of account reference');
|
||||
$table->date('transaction_date')->comment('Transaction date');
|
||||
$table->decimal('amount', 15, 2)->comment('Transaction amount');
|
||||
$table->enum('transaction_type', ['income', 'expense'])->comment('Transaction type');
|
||||
$table->string('description')->comment('Transaction description');
|
||||
$table->string('reference_number')->nullable()->comment('Reference/receipt number');
|
||||
$table->foreignId('finance_document_id')->nullable()->constrained()->nullOnDelete()->comment('Related finance document');
|
||||
$table->foreignId('membership_payment_id')->nullable()->constrained()->nullOnDelete()->comment('Related membership payment');
|
||||
$table->foreignId('created_by_user_id')->constrained('users')->cascadeOnDelete()->comment('Created by user');
|
||||
$table->text('notes')->nullable()->comment('Additional notes');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('transaction_date');
|
||||
$table->index('transaction_type');
|
||||
$table->index(['budget_item_id', 'transaction_date']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('transactions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user