admin-panel-zimbra-api/database/migrations/2024_04_15_035002_create_accounts_table.php
Nguyen Van Nguyen e9f0a9ec2c first commit
Signed-off-by: Nguyen Van Nguyen <nguyennv1981@gmail.com>
2024-04-22 14:45:23 +07:00

69 lines
2.4 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('accounts', function (Blueprint $table) {
$table->id();
$table->foreignId('agency_id')->default(0)->index();
$table->foreignId('domain_id')->default(0)->index();
$table->foreignId('cos_id')->default(0)->index();
$table->string('zimbra_cos_id')->nullable();
$table->string('zimbra_id')->unique();
$table->string('name')->unique();
$table->enum('status', [
'active',
'maintenance',
'locked',
'closed',
'lockout',
'pending',
]);
$table->string('mail_host');
$table->string('display_name');
$table->string('title')->nullable();
$table->string('organization')->nullable();
$table->string('organization_unit')->nullable();
$table->string('telephone')->nullable();
$table->string('mobile')->nullable();
$table->string('address')->nullable();
$table->timestamp('zimbra_create')->nullable();
$table->text('description')->nullable();
$table->json('attributes')->nullable();
$table->unsignedInteger('created_by')->default(0)->index();
$table->unsignedInteger('updated_by')->default(0)->index();
$table->timestamps();
});
Schema::create('aliases', function (Blueprint $table) {
$table->id();
$table->foreignId('agency_id')->default(0)->index();
$table->foreignId('domain_id')->default(0)->index();
$table->foreignId('account_id')->default(0)->index();
$table->string('name')->unique();
$table->string('zimbra_target_id');
$table->timestamp('zimbra_create')->nullable();
$table->unsignedInteger('created_by')->default(0)->index();
$table->unsignedInteger('updated_by')->default(0)->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('aliases');
Schema::dropIfExists('accounts');
}
};