GermanAirlinesVA-Social/updates/builder_table_create_members.php
2021-08-14 19:20:57 +02:00

117 lines
3.8 KiB
PHP

<?php namespace GermanAirlinesVa\Social\Updates;
use Schema;
use DB;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateGermanAirlinesVaSocialMembers extends Migration
{
public function up()
{
Schema::connection('germanairlinesva_social')->create('members', function ($table) {
$table->engine = 'InnoDB';
$table->bigIncrements('id')->unsigned();
$table
->bigInteger('member_rank_id')
->unsigned()
->default(1);
$table
->foreign('member_rank_id')
->references('id')
->on('germanairlinesva_schooling.member_ranks');
$table
->bigInteger('passenger_id')
->nullable()
->unsigned();
$table
->bigInteger('charter_id')
->nullable()
->unsigned();
$table
->bigInteger('cargo_id')
->nullable()
->unsigned();
$table
->bigInteger('heritage_id')
->nullable()
->unsigned();
$table
->bigInteger('visual_id')
->nullable()
->unsigned();
$table
->bigInteger('tour_id')
->nullable()
->unsigned();
$table->text('passenger_briefing')->nullable();
$table->text('charter_briefing')->nullable();
$table->text('cargo_briefing')->nullable();
$table->text('heritage_briefing')->nullable();
$table->text('visual_briefing')->nullable();
$table->text('tour_briefing')->nullable();
$table->boolean('is_team')->default(0);
$table->boolean('is_instructor')->default(0);
$table->boolean('show_contact')->default(0);
$table->enum('account_status', ['active', 'pending', 'inactive', 'suspended']);
$table->dateTime('last_active')->default(DB::raw('NOW()'));
$table->text('name');
$table->text('surname');
$table->text('password');
$table->string('email', 320)->unique();
$table->text('zip');
$table->text('state');
$table->text('city');
$table
->bigInteger('vatsim_id')
->nullable()
->unsigned();
$table
->bigInteger('ivao_id')
->nullable()
->unsigned();
$table->string('pilot_id', 4)->unique();
$table->date('birthday');
$table->date('member_since');
$table->text('about_me')->nullable();
$table->text('job')->nullable();
$table->double('legacy_points', 10, 0)->default(0);
$table
->bigInteger('legacy_flights')
->unsigned()
->default(0);
$table->text('signature')->nullable();
$table->bigInteger('team_sort_index')->nullable();
$table->text('team_position_short')->nullable();
$table->text('team_position_long')->nullable();
$table->text('team_member_story')->nullable();
$table->text('team_favourite_real_aircraft')->nullable();
$table->text('team_favourite_fs_aircraft')->nullable();
$table->text('team_favourite_airport')->nullable();
$table->boolean('gdpr_forum')->default(0);
$table->boolean('gdpr_newsletter')->default(0);
$table->boolean('gdpr_general')->default(0);
});
Schema::connection('germanairlinesva_schooling')->table('exams', function ($table) {
$table
->foreign('member_id')
->references('id')
->on('germanairlinesva_social.members');
});
Schema::connection('germanairlinesva_graphql')->table('graphql_keys', function ($table) {
$table
->foreign('member_id')
->references('id')
->on('germanairlinesva_social.members');
});
}
public function down()
{
Schema::connection('germanairlinesva_social')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_social')->dropIfExists('members');
Schema::connection('germanairlinesva_social')->enableForeignKeyConstraints();
}
}