Tried postgres

This commit is contained in:
Torkel Ödegaard
2014-11-24 10:17:13 +01:00
parent a8f915f049
commit be781bdb98
9 changed files with 76 additions and 49 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ func LoadModelsConfig() {
DbCfg.Name = setting.Cfg.MustValue("database", "name")
DbCfg.User = setting.Cfg.MustValue("database", "user")
if len(DbCfg.Pwd) == 0 {
DbCfg.Pwd = setting.Cfg.MustValue("database", "passwd")
DbCfg.Pwd = setting.Cfg.MustValue("database", "password")
}
DbCfg.SslMode = setting.Cfg.MustValue("database", "ssl_mode")
DbCfg.Path = setting.Cfg.MustValue("database", "path", "data/grafana.db")
+6 -6
View File
@@ -61,9 +61,9 @@ func GetAccountByLogin(emailOrLogin string) (*models.Account, error) {
func GetCollaboratorsForAccount(accountId int64) ([]*models.CollaboratorInfo, error) {
collaborators := make([]*models.CollaboratorInfo, 0)
sess := x.Table("Collaborator")
sess.Join("INNER", "Account", "Account.id=Collaborator.account_Id")
sess.Where("Collaborator.for_account_id=?", accountId)
sess := x.Table("collaborator")
sess.Join("INNER", "account", "account.id=collaborator.account_Id")
sess.Where("collaborator.for_account_id=?", accountId)
err := sess.Find(&collaborators)
return collaborators, err
@@ -91,9 +91,9 @@ func AddCollaborator(collaborator *models.Collaborator) error {
func GetOtherAccountsFor(accountId int64) ([]*models.OtherAccount, error) {
collaborators := make([]*models.OtherAccount, 0)
sess := x.Table("Collaborator")
sess.Join("INNER", "Account", "Account.id=Collaborator.account_Id")
sess.Where("Collaborator.account_id=?", accountId)
sess := x.Table("collaborator")
sess.Join("INNER", "account", "account.id=collaborator.account_Id")
sess.Where("account_id=?", accountId)
err := sess.Find(&collaborators)
return collaborators, err
}