Some checks failed
continuous-integration/drone/push Build is failing
- Complete GGZ Ecademy Laravel backend application - RESTful API for learning products, members, filters - Authentication and authorization system - Database migrations and seeders - Custom CRUD generator commands - Email notification system - Integration with frontend applications
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateAddressesTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('addresses', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->unsignedInteger('member_id');
|
|
$table->string('indicating')->nullable();
|
|
$table->enum('type', ['main', 'visiting', 'invoice', 'other']);
|
|
$table->string('first_name_contact_person')->nullable();
|
|
$table->string('last_name_contact_person')->nullable();
|
|
$table->string('infix')->nullable();
|
|
$table->string('email')->nullable();
|
|
$table->string('address')->nullable();
|
|
$table->string('postal')->nullable();
|
|
$table->string('phone')->nullable();
|
|
$table->string('city')->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
|
|
Schema::table('addresses', function (Blueprint $table) {
|
|
$table->foreign('member_id')->references('id')->on('members')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::table('addresses', function (Blueprint $table) {
|
|
$table->dropForeign('addresses_member_id_foreign');
|
|
});
|
|
|
|
Schema::dropIfExists('addresses');
|
|
}
|
|
}
|