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

40 lines
1.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContactsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contacts', 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->string('reference')->nullable();
$table->string('phone')->nullable();
$table->string('email')->nullable();
$table->string('wechat_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contacts');
}
}