14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->create(
'event_log',
function (Blueprint $table) {
27 $table->bigInteger(
'log_id')->autoIncrement();
28 $table->bigInteger(
'assoc_type');
29 $table->bigInteger(
'assoc_id');
30 $table->bigInteger(
'user_id');
31 $table->datetime(
'date_logged');
32 $table->bigInteger(
'event_type')->nullable();
33 $table->text(
'message')->nullable();
34 $table->smallInteger(
'is_translated')->nullable();
35 $table->index([
'assoc_type',
'assoc_id'],
'event_log_assoc');
39 Capsule::schema()->create(
'event_log_settings',
function (Blueprint $table) {
40 $table->bigInteger(
'log_id');
41 $table->string(
'setting_name', 255);
42 $table->text(
'setting_value')->nullable();
43 $table->string(
'setting_type', 6)->comment(
'(bool|int|float|string|object)');
44 $table->index([
'log_id'],
'event_log_settings_log_id');
45 $table->unique([
'log_id',
'setting_name'],
'event_log_settings_pkey');
49 Capsule::schema()->create(
'email_log',
function (Blueprint $table) {
50 $table->bigInteger(
'log_id')->autoIncrement();
51 $table->bigInteger(
'assoc_type');
52 $table->bigInteger(
'assoc_id');
53 $table->bigInteger(
'sender_id');
54 $table->datetime(
'date_sent');
55 $table->bigInteger(
'event_type')->nullable();
56 $table->string(
'from_address', 255)->nullable();
57 $table->text(
'recipients')->nullable();
58 $table->text(
'cc_recipients')->nullable();
59 $table->text(
'bcc_recipients')->nullable();
60 $table->string(
'subject', 255)->nullable();
61 $table->text(
'body')->nullable();
62 $table->index([
'assoc_type',
'assoc_id'],
'email_log_assoc');
66 Capsule::schema()->create(
'email_log_users',
function (Blueprint $table) {
67 $table->bigInteger(
'email_log_id');
68 $table->bigInteger(
'user_id');
69 $table->unique([
'email_log_id',
'user_id'],
'email_log_user_id');
78 Capsule::schema()->drop(
'email_log_users');
79 Capsule::schema()->drop(
'email_log');
80 Capsule::schema()->drop(
'event_log_settings');
81 Capsule::schema()->drop(
'event_log');