Skip to content
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.

Unsure if there is an issue with database prefix #22

Open
grafxflow opened this issue Aug 28, 2017 · 6 comments
Open

Unsure if there is an issue with database prefix #22

grafxflow opened this issue Aug 28, 2017 · 6 comments
Labels

Comments

@grafxflow
Copy link

I seem to be getting an error with regards to database prefix set in the config database file.

@scottbedard
Copy link
Owner

Sorry to hear that, could you be more specific about what error you're getting, and what actions led up to that error?

@grafxflow
Copy link
Author

Hi,

I have added a prefix to the database.php

'mysql' => [
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'port'      => 3306,
            'database'  => 'database',
            'username'  => 'root',
            'password'  => 'root',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => 'cms_',
        ],

It installs correctly on the database with all the columns.

cms_bedard_blogtags_post_tag

cms_bedard_blogtags_tags

But when going to choosing the blog section the default euro shows an issue with the jury missing the prefix.

Base table or view not found: 1146 Table 'october_cms.bedard_blogtags_post_tag' doesn't exist (SQL: select cms_bedard_blogtags_tags., ( select count() from bedard_blogtags_post_tag where bedard_blogtags_post_tag.tag_id = bedard_blogtags_tags.id ) as posts from cms_bedard_blogtags_tags order by name asc limit 20 offset 0)

@scottbedard
Copy link
Owner

Ah, looks like the order is using a raw subquery.
https://github.com/scottbedard/blogtags/blob/master/components/BlogTags.php#L93

I don't have time to fix it right now, but if you want to take a crack at it I'd happily accept that PR. Should be nothing more than adding an if statement checking if there are prefixes, and applying it to the query. Or, possibly a better solution would be to not use a raw query at all, and instead create the subquery via the query builder.

@grafxflow
Copy link
Author

Okay I will take a look :)

@grafxflow
Copy link
Author

I have had a look and I have found the issue but I am unsure how to add prefix to this filetype.

models/tag/columns.yaml

@scottbedard
Copy link
Owner

Oh, you were referring to the backend blog section. Yup, that will need to be updated as well.

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

No branches or pull requests

2 participants