Support the ongoing development of Laravel.io →
Configuration Database

When I am running a migration from command line I am getting the response


  • Application In Production!     *
    

Do you really wish to run this command?

This is a fresh laravel install and I am running migrate for the first time. If I give a response y to the above prompt, I am getting

[Illuminate\DatabaseQueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.users' doesn't exist (SQL: alter table users add id int unsigned not null auto_increment primary key, add username varchar(255) not null, add password varchar(255) not null, add created_at timestamp default 0 not null, add updated_at timestamp default 0 not null)

Migration file

public function up()
    {
       Schema::table('users', function(Blueprint $table)
       {
            $table->increments('id');   
            $table->string('username')->unique();
            $table->string('password');
            $table->timestamps();
        });
    }
Last updated 2 years ago.
0

There is no table named 'users' in your database yet, you should use 'Schema::create' but not 'Schema:table'

Last updated 2 years ago.
0

mkblade said:

There is no table named 'users' in your database yet, you should use 'Schema::create' but not 'Schema:table'

I have solved that problem. But my main problem is that i am getting the Application in production prompt whenever i am running a migration.

Last updated 2 years ago.
0

Does it happen if you put the application in maintenance mode ?

artisan down

Then

migrate

Then

artisan up

Last updated 2 years ago.
0

This prompt is for your safety. Doing operations on the database in a production environment, you should be very careful. The solution is to set the environment to non-production, or use --force flag.

php artisan migrate --force
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

vtav vtav Joined 8 May 2014

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.