-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Shell and Doctrine #11750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
you can't mask the table name. please print the actual output. |
Did you set a default connection? |
It would be really easier for us to help you if you post your |
@sstok this is not a part of my project, I was testing the framework in a new instalation. Obviously this is a bug. I proved it in my project too and I had the same answer. @steve-todorov the config.yml is the default. [Doctrine\ORM\Tools\ToolsException]
Schema-Tool failed with Error 'An exception occurred while executing 'CREATE TABLE Firsttable (id INT AUTO_INCREMENT NOT NULL, name VARCHA
R(255) NOT NULL, lastname VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB':
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected' while executing DDL: CREATE TABLE Firsttable (id INT AUTO_INCREMENT NOT
NULL, name VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGI
NE = InnoDB [Doctrine\DBAL\DBALException]
An exception occurred while executing 'CREATE TABLE Firsttable (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, lastname VARCH
AR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB':
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected [PDOException]
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected |
@ysramirez Hmm, googling around, it looks like this issue is usually something wrong with the PDO connection string (which you don't handle directly obviously, Doctrine does that). Could you post what your Cheers! |
This is because when running the shell, all commands run in the same process, without restarting the kernel between each of them, meaning the same DB connection is kept. In general, using the shell is very likely to create weird issues because of the way it run commands (the worse being to try to clear the cache this way). You should either avoid the shell entirely, or run it with the |
Hello @weaverryan and @stof, now the question is how to fix it. Honestly I don't use the shell so much but could be an interesting tool without these problems for many reasons for example @javiereguiluz talked about the php -S in the background and this is other trouble whit the process. If we had a solid library to drive it could be great. (I saw some code of all of you in these conversation, you are great coders) |
I don't see any way to fix the shell running without process isolation. As long as you run all commands in the same process, you will face potentially issues with side effects between commands. The |
I use the shell 2 or 3 times and notice very weird behavior with the database, a notice will be nice. |
This happend only in shell with php app/console all works fine
doctrine:database:drop --force [ok]
doctrine:database:create [ok]
doctrine:schema:create [bad] :-1:
The text was updated successfully, but these errors were encountered: