I am new to Laravel and I create a users table using php artisan migrate
command:
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('username');
$table->string('email');
$table->string('password');
$table->rememberToken();
});
After that I just needed to change the username
column as first_name
then I change the schema as follows:
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('first_name');
$table->string('email');
$table->string('password');
$table->rememberToken();
});
If I run the php artisan migrate
command again, it says Nothing to migrate
, then I used rollback
, and I lose all table data.. How can I edit table structure without affecting my data? I hate Laravel doc
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…