Saahon
Saahon

Reputation: 419

Error on php artisan migrate

I have read many post on this subject, but have not found the right answer. When i write any command php artisan migrate returns a result:

[Illuminate\Database\QueryException]
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adtmart1.shop_categories' doesn't exist (SQL: select * f
  rom `shop_categories`)


[PDOException]
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adtmart1.shop_categories' doesn't exist

I would like to move the finished website made using Laravel on the local web server. I use Web server - opensever. There php version - 5.5, Mysql - 5.5. All commands i write of the console opensever. While replying, please, take into consideration that I am new in this field

Upvotes: 0

Views: 1307

Answers (2)

James
James

Reputation: 16339

You use Schema::table to alter an existing table, you are looking for Schema::create which is used to create a new table.

Alter your migrations to use Schema::create and you'll have no trouble running your migrations:

Schema::create('name_of_table', function(Blueprint $table) {
        {

            $table->increments("id",true);
            $table->string("username")->nullable()->default(null);
            $table->string("password")->nullable()->default(null);
            $table->string("email")->nullable()->default(null);
            $table->timestamps();
        });

I have of course used dummy columns and you would use your own.

More info on the problem here.

Upvotes: 1

Alexey Mezenin
Alexey Mezenin

Reputation: 163748

First of all, you'll need to post migration code that causes the error. To do this, try to run migrations one-by-one. Remove all migrations from /database/migrations folder and then add first one (first by date it was created) back into /database/migrations. Then run php artisan migrate. If migrations was successful, do all steps for secons migration etc. When you see an error, you'll know that this one migrations causes it. Post it here please, so we could help.

Upvotes: 0

Related Questions