Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use IlluminateSupportFacadesSchema;
- use IlluminateDatabaseSchemaBlueprint;
- use IlluminateDatabaseMigrationsMigration;
- class CreateUsersTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::disableForeignKeyConstraints();
- Schema::create('users', function (Blueprint $table) {
- $table->increments('id');
- $table->string('password');
- $table->string('first_name');
- $table->string('last_name');
- $table->integer('salutation_id')->unsigned()->nullable();
- $table->string('title')->default('Volunteer');
- $table->binary('profile_picture')->nullable();
- $table->string('address')->nullable();
- $table->string('city')->nullable();
- $table->integer('province_id')->unsigned()->nullable();
- $table->integer('country_id')->unsigned()->nullable();
- $table->string('postal_code', 9)->nullable();
- $table->string('email')->unique();
- $table->string('phone')->nullable();
- $table->integer('phone_preference_id')->unsigned()->nullable();
- $table->integer('contact_preference_id')->unsigned()->nullable();
- $table->boolean('casl_agreement')->default(0);
- $table->date('casl_agreementDate')->nullable();
- $table->boolean('is_admin')->default(0);
- $table->rememberToken();
- $table->timestamps();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('users');
- }
- public function up()
- {
- Schema::table('users', function (Blueprint $table)
- {
- $table->foreign('salutation_id')->references('id')->on('salutations')->onDelete('set null');
- $table->foreign('province_id')->references('id')->on('provinces')->onDelete('set null');
- $table->foreign('country_id')->references('id')->on('countries')->onDelete('set null');
- $table->foreign('phone_preference_id')->references('id')->on('phone_preferences')->onDelete('set null');
- $table->foreign('contact_preference_id')->references('id')->on('contact_preferences')->onDelete('set null');
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('users', function (Blueprint $table) {
- });
- }
Add Comment
Please, Sign In to add comment