I am trying to run this code I cloned, but I keep getting this error..
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'roocket.permissions' doesn't exist (SQL: select * from `permissions`)
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'roocket.permissions' doesn't exist-Vue-Dashboard/blob/master/src/pages/Pages/RTLPage.vue
I have run composer install and npm install , and I am new to the laravel world.
I have uploaded the repo to my github https://github.com/arya107/laravelbackend.
I have connected the DB via XAMPP and I don't know what the problem is.
Basically, the fix for me was that I needed to comment out
{
Gate::define($permission->name , function ($user) use($permission){
return $user->hasRole($permission->roles);
});
}
Then, I was enabled to install it, and then I re-enabled the code :)
php artisan migrate
You are missing the DB table. Run the migrations included in the project to create the tables in your DB.
The migration is creating the field and relationship at same time. I would try to use separated migrations, as this answer explains:
But I always create a foreign key in a separate Schema::table() command, because some databases need you to have the column before attaching the constraint to it
I think (haven't tried it) that your database engine does not accept the creation of the foreign key relation because the FK field was not created yet.
You can also try to do a full migrate using:
php artisan migrate:fresh
That command will drop all your database tables, so be careful!
Related
when i run this code "php artisan migrate --seed" qppeaer one error like
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'naryn.modules' doesn't exist (SQL: select * from modules where module = admin/backup_v2 limit 1)
Without seeing your database, stacktrace, and code this will be hard to answer.
But is this the first time that you ran the migration? If not, it's possible that you dropped the tables (the modules table specifically), but you did not drop the migration table. If the modules migration record still exists it will not run the migration and will not cause an error, hence going to the seeder even when there's no table migrated.
I would suggest if your still on the development phase and you can still drop the tables, just drop the schema and create it again to make sure it's a clean migration.
I'm trying to run php artisan migrate command but I am getting the following error.
I have looked at many forums and tried several solutions but nothing solved my problem.
What is going on?
-
Migrations:
http://pastebin.com/mDFa1suK
http://pastebin.com/tFWj9bEd
You can not create "produtos" table with a foreign key reference before creating "categorias" table
i suggest to change to change date in migration files name to re-order migration
so that migration of "categorias" table will run first
i hope that answered the question.
I notice that in your migration files, there are no table name cremasco.#sql-3076_1e but the error showing cannot create that table.
pls check your migration table in you database see if it has the cremasco.#sql-3076_1e. and run this in your command line :
composer dumpautoload then try again to migrate the database php artisan migrate
if the problem still exist then you need to drop your databases, and migrate again.
This problem exist because we deleted the files migration but the
table migration in database still has it
.
I have read many post on this subject, but have not found the right answer. When i write any command php artisan migrate returns a result:
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adtmart1.shop_categories' doesn't exist (SQL: select * f
rom `shop_categories`)
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adtmart1.shop_categories' doesn't exist
I would like to move the finished website made using Laravel on the local web server. I use Web server - opensever. There php version - 5.5, Mysql - 5.5. All commands i write of the console opensever. While replying, please, take into consideration that I am new in this field
You use Schema::table to alter an existing table, you are looking for Schema::create which is used to create a new table.
Alter your migrations to use Schema::create and you'll have no trouble running your migrations:
Schema::create('name_of_table', function(Blueprint $table) {
{
$table->increments("id",true);
$table->string("username")->nullable()->default(null);
$table->string("password")->nullable()->default(null);
$table->string("email")->nullable()->default(null);
$table->timestamps();
});
I have of course used dummy columns and you would use your own.
More info on the problem here.
First of all, you'll need to post migration code that causes the error. To do this, try to run migrations one-by-one. Remove all migrations from /database/migrations folder and then add first one (first by date it was created) back into /database/migrations. Then run php artisan migrate. If migrations was successful, do all steps for secons migration etc. When you see an error, you'll know that this one migrations causes it. Post it here please, so we could help.
For some reason whenever I run any php artisan command I get an error saying one of my tables doesn't exist. This is true, I'm starting on a new database. What I can't figure out is why on earth artisan needs to use this table? The error that shows up is:
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table
'happylister.categories' doesn't exist (SQL: select *
from `categories` order by `name` asc)
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table
'happylister.categories' doesn't exist
I just can't figure out for the life of me where that query is coming from - even just using php artisan generates this error. I first noticed this when I tried to run php artisan migrate to set up the tables, which of course failed. Then I noticed ALL php artisan commands fail.
So my question is: why would php artisan need a table specific to my app, given that normally you should be able to use php artisan on a clean database to set it up?
A Laracasts user very kindly helped me out with this answer:
If you're referencing a model from a service provider and the
migrations have not been run, then you'll get that error. For some
reason Artisan commands like to load all the providers, even ones it
doesn't need.
Thank you to FetchTheDev over at the Laracasts forums.
Working through this tutorial, I'm down to the following step:
You should now be able to call migrate as many times as you want and it’ll work:
php artisan migrate:refresh
Upon running that command, I get the following errors:
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist (SQL: select max(batch) as aggregate
from migrations)
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist
Googling about the error (obviously without the site-specific table name) doesn't find any answers that seem to help.
Full disclosure: I'm new to Laravel, and to Stack Overflow for that matter, please go easy on me. :)
php artisan migrate will create the migrations table for you if it does not exist yet, then run any and all migrations that have not been run yet.
php artisan migrate:refresh is for resetting all existing migrations, then running them again. It expects the migrations table to already exist.
You can use php artisan list to list all available Artisan commands and their descriptions to learn more about these and other migration-related commands.