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

Nine_Tails's avatar

php artisan migrate ran successfully but doe not create tables

I ran artisan migrate command successfully but I don't see any tables created in my database.

Here is full background =>

I am using XAMPP server with PostgreSQL(9.5) (Both servers were running at the time of creating the project) for my Laravel project

I created my project with the following command:

laravel new myapp --auth

I updated my .env file as below:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=1234

then I updated database.php

'default' => env('DB_CONNECTION', 'pgsql'),

I tried running the following command

php artisan migrate

but I got this

nothing to migrate

I googled for the above problem and ran the following command

php artisan migrate:fresh

It worked and i got the following output

Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (2.46 seconds)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (2.46 seconds)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (1.54 seconds)

however, when I checked my psql terminal, I don't find any tables

C:\Users\Akshay>psql -U postgres
Password for user postgres:
psql (9.5.23)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# \d
No relations found.
postgres=#

I tried the following commands too

php artisan config:clear
php artisan cache:clear

The problem persists.

0 likes
11 replies
bobbybouwmann's avatar

Well, I can assure you that if the migrations have run correctly that the tables do exist!

Did you run config:clear before you run php artisan migrate:fresh? If not, it might be that the old config was still cached when running the command.

I also noticed that you login into postgres, but you don't select a database. Try this when logging in instead

psql -U postgres -d postgres

The in the postgres console type \dt. This will list the database and it's tables.

2 likes
ralph-daher's avatar

@bobbybouwmann Thanks to you all my tables are now gone, thank you so much man fr i can't wait to remake the whole database from scratch again!!!111

Nine_Tails's avatar

I tried your suggestion

C:\Users\Akshay>psql -U postgres -d postgres
Password for user postgres:
psql (9.5.23)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# \dt
No relations found.
postgres=#

and yes I ran config:clear first. Just to be sure, i tried it again. i still get the same problem.

bobbybouwmann's avatar

Are you sure you are connecting to the correct postgres instance? It's very weird that it is completely empty.

2 likes
Nine_Tails's avatar

I used the following code, to know which database my project is connected to

if(DB::connection()->getDatabaseName())
{
    echo "Yes! successfully connected to the DB: " . DB::connection()->getDatabaseName();
}

i get this output

Yes! successfully connected to the DB: dfr3oi3pj1j685

I don't have any database name as dfr3oi3pj1j685

postgres=# \l
                                         List of databases
   Name    |  Owner   | Encoding |      Collate       |       Ctype        |   Access privileges
-----------+----------+----------+--------------------+--------------------+-----------------------
 postgres  | postgres | UTF8     | English_India.1252 | English_India.1252 |
 template0 | postgres | UTF8     | English_India.1252 | English_India.1252 | =c/postgres          +
           |          |          |                    |                    | postgres=CTc/postgres
 template1 | postgres | UTF8     | English_India.1252 | English_India.1252 | =c/postgres          +
           |          |          |                    |                    | postgres=CTc/postgres
 test      | postgres | UTF8     | English_India.1252 | English_India.1252 |
(4 rows)
Nine_Tails's avatar

UPDATE :

I uninstalled everything (xampp, pgsql and laravel) and installed them back. I get the same error. Another interesting point is i am able to store data and perform CRUD operations using laravel. I made an app with login and registration functionality too, BUT THE TABLES DON'T SHOW UP.

bobbybouwmann's avatar

That's very odd... It must be some kind of permission issue. Have you tried given the postgres user all possible permissions?

2 likes
siangboon's avatar

i guess you may have multiple db instances in your system....

madan1994's avatar

@siangboon I am facing the same problem. I have multiple db instances. I am a beginner and taking over some ones project i don't have any documentation or KT and it's very hard to setup the project. I have created a local DB and updated the connection parameters in the .env file and ran the php artisan migrate the migration was successful yet, I don't see any tables populated in the DB. am I missing something here. Could you please help me out.

sekar_r24's avatar

did u checked via pgadmin4, whether the table exists with the columns for the particular database with select * from tablename; query?

what is the schema for the tables? Could you able to share.

Please or to participate in this conversation.