Skip to content

Commit aeed76c

Browse files
author
David Vandemaele
committed
Use mediumtext for output/exception, autotrim exception
1 parent 82c419d commit aeed76c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/Skeleton/Transaction/Log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static function create(
9898
$log->output = $output;
9999

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

104104
if ($date !== null) {

migration/20220413_141157_trim.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Database migration class
4+
*
5+
* @author David Vandemaele <[email protected]>
6+
*
7+
*/
8+
9+
namespace Skeleton\Transaction;
10+
11+
use \Skeleton\Database\Database;
12+
13+
class Migration_20220413_141157_Trim extends \Skeleton\Database\Migration {
14+
15+
/**
16+
* Migrate up.
17+
*/
18+
public function up(): void {
19+
$db = Database::get();
20+
$db->query('UPDATE transaction_log SET exception = SUBSTRING(exception, 1, 16777215);');
21+
$db->query('UPDATE transaction_log SET output = SUBSTRING(output, 1, 16777215);');
22+
$db->query('ALTER TABLE `transaction_log` MODIFY `output` mediumtext, MODIFY `exception` mediumtext;');
23+
}
24+
25+
}

0 commit comments

Comments
 (0)