Files
exchange-2.0/database/migrations/2020_10_22_071121_create_addresses_table.php
T
2020-10-24 10:31:52 +08:00

46 lines
1.5 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAddressesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('addresses', function (Blueprint $table) {
$table->id();
$table->bigInteger('country_id')->unsigned()->nullable();
$table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
$table->bigInteger('company_id')->unsigned()->nullable();
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
$table->bigInteger('state_id')->unsigned()->nullable();
$table->foreign('state_id')->references('id')->on('states')->onDelete('cascade');
$table->bigInteger('district_id')->unsigned()->nullable();
$table->foreign('district_id')->references('id')->on('districts')->onDelete('cascade');
$table->string('postcode')->nullable();
$table->string('street_one')->nullable();
$table->string('street_two')->nullable();
$table->integer('billing_type')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('addresses');
}
}