Skip to content
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

Migration problems with database names that contain dots #512

Closed
berliner opened this issue Sep 22, 2015 · 6 comments
Closed

Migration problems with database names that contain dots #512

berliner opened this issue Sep 22, 2015 · 6 comments

Comments

@berliner
Copy link

Hi,

I had a problem using phalcon migration generate today. The problem seems to be, that the database had dots in it, e.g.: database.client.project

Running phalcon migration generate in the project folder resulted in the following message:

1442939254.2028: SHOW TABLES  => 1442939254.2036 (0.00081396102905273)
1442939254.2039: DESCRIBE `database`.`client`.`project`.`abilities` 
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`project`.`abilities`' at line 1

abilities is on of the tables in that database. I had to get the migration out fast, so I simply replaced all dots in the database name with underscores, changed the config file and restarted the migration, which ran without any problems.

Using Phalcon DevTools (2.0.7) on OS X 10.10.5. I have used the same project and database with the same name and never had a problem before. I can't remember though if I have ever used the migration since the recent update from phalcon 2.0.1 to 2.0.7.

If the problem is not due to my local setup then it should be pretty straight forward to reproduce the problem. I am aware that dots are not the best bet when it comes to database names, but since this has worked in earlier versions of phalcon I wanted to share this finding.

@sergeyklay
Copy link
Contributor

@berliner Can you please explain what exotic method you used to create database?

mysql> CREATE DATABASE data.base.name;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.base.name' at line 1

mysql> CREATE DATABASE 'data.base.name';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''data.base.name'' at line 1

mysql> CREATE DATABASE data\.base\.name;
ERROR: 
Usage: \. <filename> | source <filename>

@berliner
Copy link
Author

berliner commented Feb 2, 2016

@sergeyklay I had used Sequel Pro, but you can also achieve this on the command line:

mysql> CREATE DATABASE `data.base.name`;
Query OK, 1 row affected (0.02 sec)

@sergeyklay
Copy link
Contributor

Okay. I try to deal in the near future

@sergeyklay
Copy link
Contributor

Okay. This is not Devtools issue. See phalcon/cphalcon#11359
I try to fix this in Phalcon.

Due to the fact that this isn't Devtools issue, I'm closing it.

@sergeyklay
Copy link
Contributor

@berliner Fixed in Phalcon 2.0.x

@berliner
Copy link
Author

berliner commented Feb 2, 2016

@sergeyklay Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants