If you want to create another table, just create a new migration file. It's will work.
If you create an migration named users_table
with id, first_name, last_name
. You can create an migration file like
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name',255);
$table->string('last_name',255);
$table->rememberToken();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('users');
}
If you want to add another filed like "status" without migrate:refresh. You can create another migration file like "add_status_filed_to_users_table"
public function up()
{
Schema::table('users', function($table) {
$table->integer('status');
});
}
And don't forget to add the rollback option:
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn('status');
});
}
And when you run migrate with php artitsan migration
, It just migrate the new migration file.
But if you add filed "status" into the first mgration file (users_table) and run migration. It's nothing to migrate. You need to run php artisan migrate:refresh
.
Hope this help.