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

Prefix db (table not found) #131

Open
mgralikowski opened this issue Oct 13, 2018 · 10 comments
Open

Prefix db (table not found) #131

mgralikowski opened this issue Oct 13, 2018 · 10 comments

Comments

@mgralikowski
Copy link

mgralikowski commented Oct 13, 2018

There is a problem with database prefixing.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'default.prefix_ltm_translations' doesn't exist (SQL: select locale from prefix_ltm_translations group by locale)

Library ignores that default connection has set "prefix".

Furthermore if i try to manually change column to "ltm_translations" (to non-prefixed version) still is error, this time:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'default.ltm_translations' doesn't exist

I guess there is mix of raw queries and eloquent queries. The solution is use DB::getTablePrefix() or similar in this raw queries.

@mgralikowski mgralikowski changed the title Prefix database Prefix db (table not found) Oct 13, 2018
@vsch vsch added the ☹ bug label Oct 15, 2018
@vsch
Copy link
Owner

vsch commented Oct 15, 2018

@mgralikowski, I will check the repository code to make sure it uses the variable for the translation table instead of assuming that it is ltm_translations. The SQL queries have to add the prefix manually.

@mgralikowski
Copy link
Author

I found Your method adjustTranslationTable(). For me is not proper way (better is variable with prefixed table name or with only prefix) but do a job ;) My PR remove space which cause that replacing doesn't work.

@vsch
Copy link
Owner

vsch commented Oct 15, 2018

@mgralikowski, in repository the proper function is getTranslationsTableName()

I missed a whole bunch of queries which used ltm_translations instead of getting the proper table name.

I am fixing it now and will release a fixed version.

@vsch vsch added the fixed :) label Oct 15, 2018
@vsch
Copy link
Owner

vsch commented Oct 15, 2018

@mgralikowski, fixed version released.

@mgralikowski
Copy link
Author

Should i use master version to get this fix? For now i use 5.5.

@vsch
Copy link
Owner

vsch commented Oct 16, 2018

@mgralikowski, I will need to apply the fix to 2.5 branch.

@mgralikowski
Copy link
Author

Is master branch safe to use in production and L 5.5?

@vsch
Copy link
Owner

vsch commented Oct 16, 2018

@mgralikowski, I have not tested it with 5.5 and there were a lot of changes in that branch from laravel 5.5 branch.

Unless you upgrade to Laravel 5.6 I would not recommend it.

@mgralikowski
Copy link
Author

Ah, ok.

So please, just accept pull request with this small fix #132 in 5.5 branch. It's enough for me to make production deployment.

@vsch
Copy link
Owner

vsch commented Oct 16, 2018

@mgralikowski, made a release into Laravel-5.5 branch with merge #132

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

Successfully merging a pull request may close this issue.

2 participants