Migration References->referencesUser: Changes $setPrimary from true to false

main
Igor Scheller 5 years ago
parent ad6b48bd20
commit 72123fcd31

@ -36,7 +36,7 @@ class CreateUsersTables extends Migration
}); });
$this->schema->create('users_personal_data', function (Blueprint $table) { $this->schema->create('users_personal_data', function (Blueprint $table) {
$this->referencesUser($table); $this->referencesUser($table, true);
$table->string('first_name', 64)->nullable(); $table->string('first_name', 64)->nullable();
$table->string('last_name', 64)->nullable(); $table->string('last_name', 64)->nullable();
@ -47,7 +47,7 @@ class CreateUsersTables extends Migration
}); });
$this->schema->create('users_contact', function (Blueprint $table) { $this->schema->create('users_contact', function (Blueprint $table) {
$this->referencesUser($table); $this->referencesUser($table, true);
$table->string('dect', 5)->nullable(); $table->string('dect', 5)->nullable();
$table->string('mobile', 40)->nullable(); $table->string('mobile', 40)->nullable();
@ -55,7 +55,7 @@ class CreateUsersTables extends Migration
}); });
$this->schema->create('users_settings', function (Blueprint $table) { $this->schema->create('users_settings', function (Blueprint $table) {
$this->referencesUser($table); $this->referencesUser($table, true);
$table->string('language', 64); $table->string('language', 64);
$table->tinyInteger('theme'); $table->tinyInteger('theme');
@ -64,7 +64,7 @@ class CreateUsersTables extends Migration
}); });
$this->schema->create('users_state', function (Blueprint $table) { $this->schema->create('users_state', function (Blueprint $table) {
$this->referencesUser($table); $this->referencesUser($table, true);
$table->boolean('arrived')->default(false); $table->boolean('arrived')->default(false);
$table->dateTime('arrival_date')->nullable(); $table->dateTime('arrival_date')->nullable();
@ -75,7 +75,7 @@ class CreateUsersTables extends Migration
}); });
$this->schema->create('password_resets', function (Blueprint $table) { $this->schema->create('password_resets', function (Blueprint $table) {
$this->referencesUser($table); $this->referencesUser($table, true);
$table->text('token'); $table->text('token');

@ -76,7 +76,7 @@ class CreateNewsTable extends Migration
$table->string('title', 150); $table->string('title', 150);
$table->text('text'); $table->text('text');
$table->boolean('is_meeting')->default(0); $table->boolean('is_meeting')->default(0);
$this->referencesUser($table, false); $this->referencesUser($table);
$table->timestamps(); $table->timestamps();
}); });
} }

@ -64,7 +64,7 @@ class CreateNewsCommentsTable extends Migration
$table->increments('id'); $table->increments('id');
$this->references($table, 'news', 'news_id'); $this->references($table, 'news', 'news_id');
$table->text('text'); $table->text('text');
$this->referencesUser($table, false); $this->referencesUser($table);
$table->timestamps(); $table->timestamps();
}); });
} }

@ -74,7 +74,7 @@ class CreateQuestionsTable extends Migration
'questions', 'questions',
function (Blueprint $table) { function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table, false); $this->referencesUser($table);
$table->text('text'); $table->text('text');
$table->text('answer') $table->text('answer')
->nullable(); ->nullable();

@ -11,7 +11,7 @@ trait Reference
* @param Blueprint $table * @param Blueprint $table
* @param bool $setPrimary * @param bool $setPrimary
*/ */
protected function referencesUser(Blueprint $table, $setPrimary = true) protected function referencesUser(Blueprint $table, $setPrimary = false)
{ {
$this->references($table, 'users', 'user_id', $setPrimary); $this->references($table, 'users', 'user_id', $setPrimary);
} }

Loading…
Cancel
Save