Support the ongoing development of Laravel.io →
posted 7 years ago

when i make command php artisan make:migration creata_companies_table it create table but has no schema function no id no timestamp just up and down function. any idea ?? i'm using laravel 5.4 here's my companiestable

<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCompaniesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { // } /** * Reverse the migrations. * * @return void */ public function down() { // } }
Last updated 2 years ago.
0
php artisan make:migration table_name_here

Only generates the migration file/class and its stubbed methods up()/down(). You need to code out your schema.

https://laravel.com/docs/5.4/migrations#migration-structure


    public function up()
    {
        Schema::create('companies', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->timestamps();

        });
    }

When your schema is done within the up() method, you can then run the migration with

php artisan migrate

0

Migration only creates the Migration Class. You need to create the schema by yourself in the up function. It's easy. You can get a sample schema from the documentation.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.