PDO exception on php artisan clear-compiled in Laravel 5 - exception

I am facing a weird issue with forge . I have a laravel5 app hosted on a DO Server and I use Forge as well. When I try to deploy the script after I pushed new commits , I keep getting :
> php artisan clear-compiled
[Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found:
1146 Table 'troisdemis_com.permissions' doesn't exist (SQL: select * from `permissions`)
I restarted the Server , uninstalled the repo, dropped the database ( ssh) reinstalled the repo again , and whenever I run composer install I still keep the same error.
Do you know guys what could cause the issue ?

Related

Symfony - App uses wrong database name, CLI uses the correct one

hoping to get help with possibly a silly problem. I can't get Symfony to connect to the correct database.
My config line in .env is as follows
DATABASE_URL="mysql://root:root#127.0.0.1:3306/main?serverVersion=mariadb-10.4.27"
Creating a database using CLI works just fine and the database named "main" is created
bin/console doctrine:database:create
Created database `main` for connection named default
Running migration works OK and a table is created in the database
bin/console doctrine:migrations:migrate
WARNING! You are about to execute a migration in database "main" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
> yes
[notice] Migrating up to DoctrineMigrations\Version20230117183120
[notice] finished in 28.6ms, used 22M memory, 2 migrations executed, 3 sql queries
Yet, when I try to access the site from the browser I get the following error
An exception occurred in the driver: SQLSTATE[HY000] [1049] Unknown database 'root'
Clearing the cache doesn't seem to help, I don't see any reference in the code to a database named root. Any clues on how to make Symfony to connect to the "main" database?
Cheers
P.

could not find driver SQL but migrate works

I deployed my code to server and migrated the database with command bellow:
php artisan migrate
And everything works fine.
But when I want to access to my url it throws the following exception:
could not find driver (SQL: select * from `...`)
If it cannot find the driver then how it created the tables? Am I missing something.
Also my database works fine when I run
php artisan serve
on my server and access that locally.

Cannot connect to Mysql From Rails Application

I am having my application and database hosted in EngineYard. Suddenly my application is down. I am getting this error when I looked into the log
Mysql2::Error: This connection is still waiting for a result, try again once you have the result
I tried to run some read queries from Rails console in Staging. This is working fine. Database queries returns the expected answers.
Also I checked out the Staging branch in local and checked. I could not reproduce the error in my local. So I assume there is no error in the code.
Restarting the App Server worked for me.
Syntax:
ey ssh "/engineyard/bin/app_<appname> restart" -e your_env_name --app-servers
Reference:
Engineyard command line: ey web restart not working

Regenerate YML mapping issue in Symfony 2.4

Running a Symfony 2 project, I have recently made a change in my MYSQL database, and I would like to update my schema and model structure inside my symfony project so I can use the new items that are in it.
This is what I try to do from a running instance in production:
php app/console doctrine:mapping:import --force CoreBundle yml
Here is the error I get:
[PDOException] SQLSTATE[HY000] [2002] Connection timed out
Core/Bundle exists and was already mapped this way by the past
Also note that the server is up and running, doing exchanges with the database
I cannot find a place where to see a more detailed log. Tried to configure the config.yml to add logging for doctrine but it doesn't give me more infos
Thanks in advance
Since I didn't found the source of the problem, I just deployed a new symfony app, connected it to the database and then just generated orm + entities by following the same commands. After that I just copied the /Entity folder and /orm folder and replaced it on my production env. A bit messy but it worked

Running rake migrate gives Mysql error schema_migrations.frm

I am running 5.1 on Ubuntu 10.04, and the remote server is running 5.0.51, is this a problem?
Mysql::Error: Incorrect information in file: './user/schema_migrations.frm': SELECT version FROM schema_migrations
I should say that trying to install it gives the error of the package (mysql-server-5.0 referenced but not available). I believe it is available in 9.10, but how can I add those repos to 10.04?
The migrations table on the remote database was corrupt. I had to rebuild it.