2021_07_06_130935_create_v_cards_table.php 1.71 KB
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateVCardsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('v_cards', function (Blueprint $table) {
            $table->id();

            $table->bigInteger('external_id');
            $table->bigInteger('campaign_external_id');
            $table->bigInteger('campaign_id')->unsigned();

            $table->string('country')->nullable();
            $table->string('city')->nullable();
            $table->string('work_time')->nullable();
            $table->json('phone')->nullable();
            $table->string('street')->nullable();
            $table->string('house')->nullable();
            $table->string('building')->nullable();
            $table->string('apartment')->nullable();
            $table->json('instant_messenger')->nullable();
            $table->string('company_name')->nullable();
            $table->string('extra_message')->nullable();
            $table->string('contact_email')->nullable();
            $table->string('ogrn')->nullable();
            $table->string('metro_station_id')->nullable();
            $table->json('point_on_map')->nullable();
            $table->string('contact_person')->nullable();

            $table->foreign('campaign_id')->references('id')->on('campaigns')
                ->cascadeOnDelete();

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('v_cards');
    }
}