Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

roy88's avatar
Level 1

PHP migration

Hi. I'm a newbie in Laravel. I've successfully migrated 2 tables in database but when I enter php migrate::refresh in cmd, the 3rd table wont show up. Can someone help me? Thanks a lot

0 likes
9 replies
roy88's avatar
Level 1

C:\Users\CWSS 16-10\Desktop\Lara53>php artisan db:seed

[Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lara53.users' do esn't exist (SQL: insert into users (name, email, password, rememb er_token, updated_at, created_at) values (Shea Runolfsdottir MD, kelsi e79@example.org, $2y$10$3XmkCKeBWBNZYx.YDBlXkuORiu0t7SeY4cw6ImimjS8N3QuHpHv MC, Ar8WBo0nRG, 2017-05-02 09:05:11, 2017-05-02 09:05:11))

[PDOException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lara53.users' do esn't exist

Nash's avatar

You are trying to seed the "users" table, which apparently, does not exist? Try php artisan migrate (for the latest migration) or php artisan migrate:refresh (to roll back all migrations and re-create the database)

roy88's avatar
Level 1

C:\Users\CWSS 16-10\Desktop\Lara53>php artisan migrate:refresh Nothing to rollback.

[Illuminate\Database\QueryException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre ady exists (SQL: create table users (id int unsigned not null auto_incr ement primary key, name varchar(255) not null, email varchar(255) not n ull, password varchar(255) not null, remember_token varchar(100) null, created_at timestamp null, updated_at timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)

[PDOException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre ady exists

roy88's avatar
Level 1

I have tried. This is the problem that I am stuck with

roy88's avatar
Level 1

No, it shows this instead 'Nothing to rollback' .

Nash's avatar

@roy88 Maybe you should just try to delete the database and migrate from scratch with php artisan migrate. Since you only have 2-3 tables, I take it we are not talking about a production database anyways.

If it still won't run, then there must be something wrong with the migrations themselves, e.g. duplicate creation of the same tables, missing/faulty code, wrong order etc.

roy88's avatar
Level 1

okay. Thank you nash. its already done btw ;)

Please or to participate in this conversation.