I've created a table using command
create table: php artisan make:migration create_movie --create=movie
then added body & user_id columns to code
public function up()
{
Schema::create('movie', function (Blueprint $table) {
$table->increments('id');
$table->text('body');
$table->integer('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('movie');
}
then hit php artisan migrate command
but this is showing me this exception and I'm not able to add movie table to the database
[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users
(
id
int unsigned not null auto_increment primary key, name
varchar(255) not null, email
varchar(255) not null,
password
varchar(255) not null, remember_token
varchar(100) null, created_at
timestamp null, updated_at
tim
estamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)
[PDOException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
migrations
table? It seems the problem is when trying to create (or re-create)users
table, not thismovie
table. - fmgonzalezusers
table is not added with artisan command but still exists. If you don't care of data in tables (careful, this would delete all tables) try withphp artisan migrate:fresh
orphp artisan migrate:refresh
commands. Or you can delete tables manually than issuephp artisan migrate
command. - Tpojka