@siewlon6093 There are two ways to fix that.
-
Delete all tables and run
php artisan migrate -
Delete
admin_settingsrelated row from themigrationstable and runphp artisan migrate:refresh.
Hope it will work.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
QLSTATE[42S01]: Base table or view already exists: 1050 Table 'admin_settings' already exists
I delete the admin_settings table and run php artisan migrate its show error too
Base table or view not found: 1146 Table
@siewlon6093 There are two ways to fix that.
Delete all tables and run php artisan migrate
Delete admin_settings related row from the migrations table and run php artisan migrate:refresh.
Hope it will work.
@tisuchi yes first delete all tables
composer dump-autoload
php artisan migrate
yes I have done all the step @tisuchi
Base table or view not found: 1146 Table '
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AdminSettings extends Model {
protected $guarded = array();
public $timestamps = false;
}
This is my models
@siewlon6093 What do you mean by done all the step?
I simply prefer if you don't have any important data in your tables, then delete all the tables from your database.
Then just run php artisan migrate command.
If you have still issue, don't forget to run the following commands that @siewlon6093 suggested...
composer dump-autoload
php artisan migrate
yes @tisuchi I already delete all the tables in database and run php artisan migrate
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'euzlarmy_21pixar.admin_settings' doesn't exist (SQL: select * from `admin_settings` limit 1)
composer dump-autoload
Illuminate\Database\QueryException : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'euzlarmy_21pixar.admin_settings' doesn't exist (SQL: select * from `admin_settings` limit 1)
@siewlon6093 it seems the cache issue.
You can run php artisan and composer to get the available list of commands.
However, I can suggest running these following commands to remove cache-
composer clearcache
php artisan cache:clear
OMG @tisuchi annoying error :(
When I run composer clear-cache, It clear all the cache
but when I run php artisan cache:clear go back to same errors
If you dont have sensitive data on your database run:
php artisan migrate:fresh
can you post the code to admin_settings migrations, and a screen shot of all your migrations, i dont see why its trying to do select statement?
also if this is in your local server, then create a fresh database in sql, and change your .env to point to that and run php artisan migrate just to be sure
php artisan migrate:fresh @untymage
Base table or view not found: 1146 Table 'euzlarmy_21pixar.admin_settings' doesn't exist (SQL: select * from `admin_settings` limit 1)
@siewlon6093 what if you run these commands?
composer clear-cache
php artisan migrate
@siewlon6093 - Try
1. php artisan cache:clear
2. php artisan migrate:fresh
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminSettingsTable extends Migration {
/**
* Run the migrations.
*
*
* @return void
*/
public function up()
{
Schema::create('admin_settings', function(Blueprint $table)
{
$table->increments('id');
$table->string('title');
$table->text('description');
$table->string('welcome_text', 200);
$table->text('welcome_subtitle');
$table->string('keywords');
$table->integer('result_request')->unsigned()->comment('The max number of images per request');
$table->integer('limit_upload_user')->unsigned();
$table->enum('status_page', array('0','1'))->default('1')->comment('0 Offline, 1 Online');
$table->integer('message_length')->unsigned();
$table->integer('comment_length')->unsigned();
$table->enum('registration_active', array('0','1'))->default('1')->comment('0 No, 1 Yes');
$table->enum('email_verification', array('0','1'))->comment('0 Off, 1 On');
$table->string('email_no_reply', 200);
$table->string('email_admin', 200);
$table->enum('captcha', array('on','off'))->default('on');
$table->integer('file_size_allowed')->unsigned()->comment('Size in Bytes');
$table->enum('facebook_login', array('on','off'))->default('off');
$table->text('google_analytics');
$table->enum('invitations_by_email', array('on','off'))->default('on');
$table->string('twitter', 200);
$table->string('facebook', 200);
$table->string('googleplus', 200);
$table->string('linkedin', 200);
$table->string('instagram', 200);
$table->text('google_adsense');
$table->enum('auto_approve_images', array('on','off'))->default('off');
$table->integer('tags_limit')->unsigned();
$table->enum('downloads', array('all','users'))->default('all');
$table->enum('google_ads_index', array('on','off'))->default('off');
$table->integer('description_length')->unsigned();
$table->string('min_width_height_image', 25);
$table->text('google_adsense_index');
$table->string('link_privacy', 200);
$table->string('link_terms', 200);
$table->enum('twitter_login', array('on','off'))->default('off');
$table->enum('paypal_sandbox', array('true','false'))->default('true');
$table->string('paypal_account', 200);
$table->integer('fee_commission')->unsigned();
$table->string('stripe_secret_key', 200);
$table->string('stripe_public_key', 200);
$table->integer('max_deposits_amount')->unsigned();
$table->integer('min_deposits_amount')->unsigned();
$table->integer('min_sale_amount')->unsigned();
$table->integer('max_sale_amount')->unsigned();
$table->enum('enable_paypal', array('0','1'))->default('0');
$table->enum('enable_stripe', array('0','1'))->default('0');
$table->enum('currency_position', array('left','right'))->default('left');
$table->string('currency_symbol', 200);
$table->string('currency_code', 200);
$table->integer('amount_min_withdrawal')->unsigned();
$table->enum('sell_option', array('on','off'))->default('on');
$table->enum('show_images_index', array('latest','featured','both'))->default('latest');
$table->enum('show_watermark', array('1','0'))->default('1');
$table->integer('file_size_allowed_vector')->unsigned()->default(1024);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('admin_settings');
}
}
@tisuchi return to same issue
@hjortur17 return to same issue :(
@siewlon6093 - What happens if you change Schema::create to Schema::table?
@siewlon6093 - Are you using hasMany relationship for something?
Please or to participate in this conversation.