Skip to content

Commit

Permalink
Use mediumtext for output/exception, autotrim exception
Browse files Browse the repository at this point in the history
  • Loading branch information
David Vandemaele committed Apr 13, 2022
1 parent 82c419d commit aeed76c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Skeleton/Transaction/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function create(
$log->output = $output;

if (isset($t) === true) {
$log->exception = print_r($t, true);
$log->exception = substr(print_r($t, true), 0, 16777215);
}

if ($date !== null) {
Expand Down
25 changes: 25 additions & 0 deletions migration/20220413_141157_trim.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Database migration class
*
* @author David Vandemaele <[email protected]>
*
*/

namespace Skeleton\Transaction;

use \Skeleton\Database\Database;

class Migration_20220413_141157_Trim extends \Skeleton\Database\Migration {

/**
* Migrate up.
*/
public function up(): void {
$db = Database::get();
$db->query('UPDATE transaction_log SET exception = SUBSTRING(exception, 1, 16777215);');
$db->query('UPDATE transaction_log SET output = SUBSTRING(output, 1, 16777215);');
$db->query('ALTER TABLE `transaction_log` MODIFY `output` mediumtext, MODIFY `exception` mediumtext;');
}

}

0 comments on commit aeed76c

Please sign in to comment.