1: <?php
2:
3: use Illuminate\Database\Migrations\Migration;
4: use Illuminate\Database\Schema\Blueprint;
5: use Illuminate\Database\Capsule\Manager as Capsule;
6:
7: class CreateMailAccountsTable extends Migration
8: {
9: /**
10: * Run the migrations.
11: *
12: * @return void
13: */
14: public function up()
15: {
16: Capsule::schema()->create('mail_accounts', function (Blueprint $table) {
17: $table->increments('Id');
18:
19: $table->boolean('IsDisabled')->default(false);
20: $table->integer('IdUser')->default(0);
21: $table->boolean('UseToAuthorize')->default(false);
22:
23: $table->string('Email')->default('');
24: $table->string('FriendlyName')->default('');
25: $table->string('IncomingLogin')->default('');
26: $table->string('IncomingPassword')->default('');
27:
28: $table->boolean('IncludeInUnifiedMailbox')->default(false);
29: $table->boolean('UseSignature')->default(false);
30: });
31:
32: $prefix = Capsule::connection()->getTablePrefix();
33: Capsule::statement("ALTER TABLE {$prefix}mail_accounts ADD Signature MEDIUMBLOB");
34:
35: Capsule::schema()->table('mail_accounts', function (Blueprint $table) {
36: $table->unsignedInteger('ServerId')->default(0);
37: $table->foreign('ServerId')->references('Id')->on('mail_servers');
38: });
39:
40: Capsule::statement("ALTER TABLE {$prefix}mail_accounts ADD FoldersOrder MEDIUMBLOB");
41:
42: Capsule::schema()->table('mail_accounts', function (Blueprint $table) {
43: $table->boolean('UseThreading')->default(false);
44: $table->boolean('SaveRepliesToCurrFolder')->default(false);
45: $table->boolean('ShowUnifiedMailboxLabel')->default(false);
46:
47: $table->string('UnifiedMailboxLabelText')->default('');
48: $table->string('UnifiedMailboxLabelColor')->default('');
49: $table->string('XOAuth')->nullable();
50:
51: $table->timestamp(\Aurora\System\Classes\Model::CREATED_AT)->nullable();
52: $table->timestamp(\Aurora\System\Classes\Model::UPDATED_AT)->nullable();
53: });
54: }
55:
56: /**
57: * Reverse the migrations.
58: *
59: * @return void
60: */
61: public function down()
62: {
63: Capsule::schema()->dropIfExists('mail_accounts');
64: }
65: }
66: