-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: Add attachments to Transactions
- Loading branch information
Showing
4 changed files
with
149 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
## 5.0.2 - 2024-02-19 | ||
|
||
- Add Attachments to Transactions | ||
## 5.0.1 - 2023-04-18 | ||
|
||
- Add Laravel 10 Compatibility | ||
|
50 changes: 50 additions & 0 deletions
50
database/migrations/2024_13_02_180135_add_transaction_attachments_columns.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddTransactionAttachmentsColumns extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table( | ||
config('ifrs.table_prefix') . 'transactions', | ||
function (Blueprint $table) { | ||
$table->unsignedBigInteger('attachment_id')->nullable(); | ||
$table->string('attachment_type')->nullable(); | ||
} | ||
); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table( | ||
config('ifrs.table_prefix') . 'transactions', | ||
function (Blueprint $table) { | ||
if (config('database.default') == 'sqlite') { | ||
DB::statement('PRAGMA foreign_keys = OFF;'); // sqlite needs to drop the entire table to remove a column, which fails because the table is already referenced | ||
} | ||
$table->dropColumn('attachment_id'); | ||
} | ||
); | ||
|
||
Schema::table( | ||
config('ifrs.table_prefix') . 'transactions', | ||
function (Blueprint $table) { | ||
$table->dropColumn('attachment_type'); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters