Reputation:
I cannot migrate and make a new table field in phpmyadmin
in my database it is giving me this error why?
my Modal name Setting
here is my modal as you can see I can't insert anything still coz I don't have my table in phpmyadmin
.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
//
}
my Migration
here is my migration
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
$table->string('settings_code');
$table->string('subject');
$table->text('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('settings');
}
Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'clients' already exists (SQL: create table
clients
(id
int unsigned not null auto_increment primary key,client_code
varchar(191) not null,client_name
varchar(191) not null,address
varchar(191) not null,tel_no
varchar(191) not null,contact_person
varchar(191) not null,mobile_no
varchar(191) not null,email_ad
varchar(191) not null,website
varchar(191) not null,deleted_at
timestamp null,created_at
timestamp null,updated_at
timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
I want to create a new table not client table but it is giving me this error. why?
Upvotes: 0
Views: 568
Reputation: 97
hi try to romove your database from phpmyadmin and create again then run php artisan migrate to login go to your table user and create a user manually in BD and in your model put fillable with your data stored
Upvotes: 0
Reputation: 1560
Run:php artisan migrate:fresh
Be warned This will remove anything stored within the database so ensure you have a Seeder setup to place any relevant content back into the database.
In the event you get an Specified key was too long error on the re migrate open AppServiceProvider and add:
Schema::defaultStringLength(191); into the boot function
Ensure you add use Illuminate\Support\Facades\Schema; at the top of the AppServiceProvider file
Upvotes: 3