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

Database table prefix support #2714

Open
andresmazzo opened this issue Mar 17, 2020 · 7 comments
Open

Database table prefix support #2714

andresmazzo opened this issue Mar 17, 2020 · 7 comments

Comments

@andresmazzo
Copy link

Actually it's required to have a dedicated database for huginn to not merge tables from other software systems.

Some cool foss projects like MediaWiki, Matomo, etc have an environment variable to set table prefix. I think it's something easy to provide and extremely useful for users that have multiple softwares and wants to have them in one database.

Mediawiki example: https://www.mediawiki.org/wiki/Manual:$wgDBprefix

@dsander
Copy link
Collaborator

dsander commented Apr 1, 2020

We are using the Ruby on Rails framework and it doesn't look like it has good support for using a global table prefix.

Normally our users create a dedicated database for Huginn which also makes backups a lot easier.

@andresmazzo
Copy link
Author

Oh interesting. I didn't thought about framework limitations. Table prefix is useful for saas systems, having to deal with a significant amount of services for multiple clients/customers/orgs/etc.
I'm not a Ruby on Rails developer, but found that v5.2.3 has support:
https://api.rubyonrails.org/classes/ActiveRecord/ModelSchema.html#method-c-table_name_prefix

@dsander
Copy link
Collaborator

dsander commented Apr 6, 2020

Table prefix is useful for saas systems, having to deal with a significant amount of services for multiple clients/customers/orgs/etc.

Especially in that use case having one database per customer would be beneficial, otherwise one customer could read the data of another. Any reason why you can't use a separate database for Huginn?

@andresmazzo
Copy link
Author

Sure i can and i did that like a workaround, but it makes more complex the setup because i have to create the db, config user permissions for this new db, etc.
I understand that maybe itsn't the most common use case, but it simplifies the installation and maintenance for big scenarios using code as infraestructure and other techniques for example.

@dsander
Copy link
Collaborator

dsander commented May 6, 2020

I understand that it would be easier to set up in certain scenarios, but don't see one in which it is a good idea. Not sure if there are databases that support setting permissions on a table (prefix) level, but even if there is I think the required configuration of either creating a DB per Huginn instance or setting permissions per prefix sounds similar to me.

@andresmazzo
Copy link
Author

Would be interesting to learn why softwares like Matomo, MediaWiki, Gitea, Yourls and others support it. I really don't know if there is a "best practice" on this database management doubt 😕 .

@dsander
Copy link
Collaborator

dsander commented May 9, 2020

In my experience most PHP applications support it because they are commonly hosted using shared hosting providers which used to give you only one database per account.

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

No branches or pull requests

2 participants