Add logging table

[MAILPOET-570]
This commit is contained in:
Pavel Dohnal
2018-08-27 16:56:26 +02:00
parent 12af3a3e14
commit 9e2a4edcd0

View File

@ -13,7 +13,7 @@ class Migrator {
function __construct() { function __construct() {
$this->prefix = Env::$db_prefix; $this->prefix = Env::$db_prefix;
$this->charset_collate = Env::$db_charset_collate; $this->charset_collate = Env::$db_charset_collate;
$this->models = array( $this->models = [
'segments', 'segments',
'settings', 'settings',
'custom_fields', 'custom_fields',
@ -37,8 +37,9 @@ class Migrator {
'statistics_opens', 'statistics_opens',
'statistics_unsubscribes', 'statistics_unsubscribes',
'statistics_forms', 'statistics_forms',
'mapping_to_external_entities' 'mapping_to_external_entities',
); 'log',
];
} }
function up() { function up() {
@ -432,6 +433,16 @@ class Migrator {
return $this->sqlify(__FUNCTION__, $attributes); return $this->sqlify(__FUNCTION__, $attributes);
} }
function log() {
$attributes = [
'name VARCHAR(255),',
'level INTEGER,',
'message LONGTEXT,',
'time TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
];
return $this->sqlify(__FUNCTION__, $attributes);
}
private function sqlify($model, $attributes) { private function sqlify($model, $attributes) {
$table = $this->prefix . Helpers::camelCaseToUnderscore($model); $table = $this->prefix . Helpers::camelCaseToUnderscore($model);