Ich habe diese Migration:Autoinkrement Spalten-ID startet nicht von 1
public function up()
{
Schema::create('players', function (Blueprint $table) {
$table->increments('id');
$table->char('country_code',2);
$table->integer('unoi_id');
$table->string('first_name');
$table->string('last_name');
$table->char('gender', 1);
$table->timestamp('birthdate');
$table->integer('school_id');
$table->string('school_period');
$table->string('school_level');
$table->integer('points');
$table->timestamps();
});
Schema::table('players', function(Blueprint $table){
$table->foreign('country_code')->references('country_code')->on('countries');
});
}
Wenn ich einen neuen Rekord bin die Schaffung der Wert in der Spalte ID nicht auf 1. geht es los wie 321.654 in etwas beginnt und dann jedes Mal um eins erhöht.
Meine Frage ist: Was kann ich tun, um den Standardwert auf 1 zu setzen?
https://stackoverflow.com/questions/8923114/how-to-reset-auto- increment-in-mysql laravel hat einen Befehl migrate fresh: https://laravel-news.com/migrate-fresh – mkaatman
migrate: fresh ist Laravel 5.5. Die aktuelle stabile Version von Laravel ist 5.4 – Brad
Danke. Ich habe nie darüber nachgedacht, es direkt mit einem mysql-Befehl zu tun. –