W linii poleceń przechodzimy do głównego katalogu strony i wpisujemy:
php artisan make:migration create_posts_table
Następnie edytujemy wygenerowany plik i dopisujemy własne pola:
vim database/migrations/2023_04_25_131201_create_posts_table.php
...
Schema::create('posts', function (Blueprint $table) {
$table->bigIncrements('id'); //auto increment
$table->string('title',500);
$table->string('type',20)->nullable();
$table->string('image',200)->nullable();
$table->text('content')->nullable();
$table->tinyInteger('active')->nullable()->default(1);
$table->timestamp('date_create')->useCurrent();
$table->timestamps();
});
...
Następnie uruchamiamy migrację dla pojedynczej tabeli:
php artisan migrate --path=database/migrations/2023_04_25_131201_create_posts_table.php
lub dla wszystkich tabel:
php artisan migrate
Źródło: https://stackoverflow.com/questions/45473624/laravel-migrate-specific-files-from-migrations