osb/database/migrations/0221-create_email.php

87 lines
2.4 KiB
PHP
Raw Permalink Normal View History

2024-06-21 07:43:32 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplier_email', function (Blueprint $table)
{
$table->id();
$table->timestamps();
$table->integer('site_id')->unsigned();
$table->boolean('active')->default(false);
$table->string('product_id');
$table->string('product_desc')->nullable();
$table->float('base_cost');
$table->float('setup_cost')->nullable();
$table->integer('contract_term')->nullable();
$table->integer('supplier_detail_id')->unsigned();
$table->foreign(['supplier_detail_id','site_id'])->references(['id','site_id'])->on('supplier_details');
$table->unique(['id','site_id']);
});
Schema::create('product_email', function (Blueprint $table)
{
$table->id();
$table->timestamps();
$table->integer('site_id')->unsigned();
$table->boolean('active')->default(false);
;
$table->string('product_id');
$table->string('product_desc')->nullable();
$table->float('base_cost');
$table->float('setup_cost')->nullable();
$table->integer('contract_term')->nullable();
$table->integer('supplier_item_id')->unsigned();
$table->foreign(['supplier_item_id','site_id'])->references(['id','site_id'])->on('supplier_email');
$table->unique(['id','site_id']);
});
Schema::create('service_email', function (Blueprint $table)
{
$table->id();
$table->integer('site_id')->unsigned();
$table->string('domain_name',128);
$table->date('expire_at')->nullable();
$table->string('admin_url')->nullable();
$table->string('admin_user')->nullable();
$table->string('admin_pass')->nullable();
$table->integer('accounts')->nullable();
$table->integer('service_id')->unsigned();
$table->foreign(['service_id','site_id'])->references(['id','site_id'])->on('services');
$table->integer('tld_id')->unsigned();
$table->foreign('tld_id')->references('id')->on('tlds');
$table->unique(['id','site_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('service_email');
Schema::dropIfExists('product_email');
Schema::dropIfExists('supplier_email');
}
};