Files
exchange-2.0/database/migrations/2020_10_22_071121_create_addresses_table.php
T
omair saleh 05401f6bbc large commit
2021-03-11 13:06:40 +08:00

47 lines
1.3 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->foreignId('company_id')->unsigned();
$table->foreignId('country_id')->unsigned();
$table->foreignId('state_id')->unsigned();
$table->foreignId('district_id')->unsigned();
$table->string('postcode');
$table->string('street_one');
$table->string('street_two')->nullable();
$table->integer('billing')->default(true);
$table->softDeletes();
$table->timestamps();
$table->foreign('country_id')->references('id')->on('countries');
$table->foreign('company_id')->references('id')->on('companies');
$table->foreign('state_id')->references('id')->on('states');
$table->foreign('district_id')->references('id')->on('districts');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('addresses');
}
}