Skip to content

Commit

Permalink
Merge pull request #57 from insane-code/feat/0.x-fees
Browse files Browse the repository at this point in the history
fix: remove default value for json fields to support mysql 8
  • Loading branch information
jesusantguerrero authored Feb 8, 2024
2 parents 0a778dd + 122883c commit 9351ad2
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 10 deletions.
13 changes: 13 additions & 0 deletions src/Models/Core/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ class Transaction extends Model
const DIRECTION_DEBIT = 'DEPOSIT';
const DIRECTION_CREDIT = 'WITHDRAW';
const DIRECTION_ENTRY = 'ENTRY';

const STATUS_DRAFT = 'draft';
const STATUS_PLANNED = 'planned';
const STATUS_VERIFIED = 'verified';
const STATUS_CANCELED = 'canceled';

const ENTRY_TYPE_OPENING = 'opening';
const ENTRY_TYPE_TRANSFER = 'transfer';
const ENTRY_TYPE_CLOSING = 'closing';
const ENTRY_TYPE_ADJUSTING = 'adjusting';
const ENTRY_TYPE_EXPENSE_ACCRUAL = 'expense_accrual';
const ENTRY_TYPE_REVENUE_ACCRUAL = 'revenue_accrual';
const ENTRY_TYPE_EXPENSE_DEFERRAL = 'expense_referral';
const ENTRY_TYPE_REVENUE_DEFERRAL = 'revenue_referral';
const ENTRY_TYPE_COMPOUND = 'compound';
const ENTRY_TYPE_REVERSING = 'reversing';


protected $fillable = [
'team_id',
'user_id',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePaymentDocumentsTable extends Migration
{
Expand Down Expand Up @@ -32,8 +32,8 @@ public function up()
$table->string('reference', 200)->nullable();
$table->text('notes')->nullable();
$table->boolean('checked')->default(false);
$table->json('meta_data')->default('[]');
$table->json('documents')->default('[]');
$table->json('meta_data')->nullable();
$table->json('documents')->nullable();
$table->timestamps();
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePaymentsTable extends Migration
{
Expand Down Expand Up @@ -36,7 +36,7 @@ public function up()
$table->string('reference', 200)->nullable();
$table->text('notes')->nullable();
$table->boolean('checked')->default(false);
$table->json('documents')->default('[]');
$table->json('documents')->nullable();
$table->timestamps();
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
Expand All @@ -22,7 +22,7 @@ public function up()

// content
$table->string('name');
$table->json('hexColors');
$table->json('hexColors')->nullable();
$table->enum('price_modifier_operator', ['plus', 'minus']);
$table->enum('price_modifier_type', ['fixed', 'percent']);
$table->decimal('price_modifier_amount', 11, 2);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fiscal_periods', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id');
$table->foreignId('team_id');
// context
$table->string('name')->nullable();
$table->date('start_date');
$table->date('end_date');
// structure
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('fiscal_periods');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('accounting_locks', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id');
$table->foreignId('team_id');
// context
$table->string('name')->nullable();
$table->date('transactions_lock_date');
$table->date('tax_return_lock_date')->nullable();
$table->date('all_users_lock_date')->nullable();
// structure
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('accounting_locks');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transactions', function (Blueprint $table) {
$table->string('entry_type')->after('number')->nullable();
});
}
};

0 comments on commit 9351ad2

Please sign in to comment.