[x]
):Hello , I suggest to add A uniform prefix, such as gitea_
, to the database table names. It will be usefull for user who want to use one datebase for many application programs. and can prevent tables from being deleted by using other apps, thanks.
As of 1.12.0 you will be able to specify a database schema in PostgreSQL different from default
. No work has been done for other databases ATM.
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Hmm, This issue is forgoten in long time, please check it agin. Thanks @guillep2k
Now add more messages about this issue reason. That's Because some users use more than one apps in one database. I know it's not a good idea, But if user do it, We will face a problem that other app will do change in gitea's table accidentally. if add prefix on table name. This can be prevented to some extent. I know it's a big work or even not necessary. so this issue can be closed if you like. Thanks
This is not difficult since xorm support that. We only need a PR.
x.SetTableMapper(names.NewPrefixMapper("gitea_", x.GetTableMapper()))
This is not difficult since xorm support that. We only need a PR.
x.SetTableMapper(names.NewPrefixMapper("gitea_", x.GetTableMapper()))
Hmm, but Don't forget we have use x.SQL or x.Exec in many places ... 馃槄
example:
However I personally think that using the same database for different applications is bad practice, since all three engines (disregarding SQLite) support multiple databases for a single instance (and do have, like MSSQL's master
, model
, tempdb
, etc.).
If two apps share the same "database", access permissions become more complicated, maintenance (backup, tuning) is more difficult, and _restoring_ the database in case of data loss (e.g. a bad operation) forces to restore all the inter-dependent applications, even if only one of them was affected. I don't know what would be a good argument in favor of sharing a single database.
I know it, But many apps like discuz(pre_) , wordpress(wp_) have it, maybe it's want to label their apps's tables, or just follow some unify name rules .... 馃
We have to also create a wrap function
```go
func realTablename("tablename") string {
return prefix+"tablename"
}
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
ping, I will try it a few days later.