admin-panel-zimbra-api/database/migrations/2024_04_15_034100_create_agencies_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

58 lines
1.8 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('agencies', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email');
$table->string('telephone')->nullable();
$table->string('mobile')->nullable();
$table->text('address')->nullable();
$table->string('organization')->nullable();
$table->text('description')->nullable();
$table->unsignedInteger('created_by')->default(0)->index();
$table->unsignedInteger('updated_by')->default(0)->index();
$table->timestamps();
});
Schema::create('agency_members', function (Blueprint $table) {
$table->id();
$table->foreignId('agency_id')->default(0)->index();
$table->unsignedInteger('user_id')->default(0);
});
Schema::create('agency_mail_hosts', function (Blueprint $table) {
$table->id();
$table->foreignId('agency_id')->default(0)->index();
$table->unsignedInteger('mail_host_id')->default(0);
});
Schema::create('agency_coses', function (Blueprint $table) {
$table->id();
$table->foreignId('agency_id')->default(0)->index();
$table->unsignedInteger('cos_id')->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('agency_coses');
Schema::dropIfExists('agency_mail_hosts');
Schema::dropIfExists('agency_members');
Schema::dropIfExists('agencies');
}
};