37 lines
3.4 KiB
JavaScript
37 lines
3.4 KiB
JavaScript
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
|
});
|
||
|
};
|
||
|
import Migration from "../db/Migration";
|
||
|
import { query } from "../db/MysqlConnectionManager";
|
||
|
/**
|
||
|
* Must be the first migration
|
||
|
*/
|
||
|
export default class CreateLogsTable extends Migration {
|
||
|
install() {
|
||
|
return __awaiter(this, void 0, void 0, function* () {
|
||
|
yield query('CREATE TABLE logs(' +
|
||
|
'id INT NOT NULL AUTO_INCREMENT,' +
|
||
|
'level TINYINT UNSIGNED NOT NULL,' +
|
||
|
'message TEXT NOT NULL,' +
|
||
|
'log_id BINARY(16),' +
|
||
|
'error_name VARCHAR(128),' +
|
||
|
'error_message VARCHAR(512),' +
|
||
|
'error_stack TEXT,' +
|
||
|
'created_at DATETIME NOT NULL DEFAULT NOW(),' +
|
||
|
'PRIMARY KEY (id)' +
|
||
|
')');
|
||
|
});
|
||
|
}
|
||
|
rollback() {
|
||
|
return __awaiter(this, void 0, void 0, function* () {
|
||
|
yield query('DROP TABLE logs');
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ3JlYXRlTG9nc1RhYmxlLmpzIiwic291cmNlUm9vdCI6Ii4vIiwic291cmNlcyI6WyJtaWdyYXRpb25zL0NyZWF0ZUxvZ3NUYWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjo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