diff options
author | Unknwon <joe2010xtmf@163.com> | 2015-02-11 21:58:37 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2015-02-11 21:58:37 -0500 |
commit | 7e7160eefd6524013003d1c9668db4d358df5251 (patch) | |
tree | 4ca5963cfb5c0dbe8e806942cdf8d6997580a6f0 /models/models.go | |
parent | c5c467a9cd805c7cd0fb93f467e0205ee082cca3 (diff) | |
download | gitea-7e7160eefd6524013003d1c9668db4d358df5251.tar.gz gitea-7e7160eefd6524013003d1c9668db4d358df5251.zip |
first pass work on migration #925
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/models/models.go b/models/models.go index dbe3947495..141e3ac497 100644 --- a/models/models.go +++ b/models/models.go @@ -40,24 +40,29 @@ var ( } EnableSQLite3 bool - UseSQLite3 bool ) func init() { tables = append(tables, - new(User), new(PublicKey), new(Follow), new(Oauth2), new(AccessToken), - new(Repository), new(Watch), new(Star), new(Action), new(Access), + new(User), new(PublicKey), new(Oauth2), new(AccessToken), + new(Repository), new(Collaboration), new(Access), + new(Watch), new(Star), new(Follow), new(Action), new(Issue), new(Comment), new(Attachment), new(IssueUser), new(Label), new(Milestone), new(Mirror), new(Release), new(LoginSource), new(Webhook), new(UpdateTask), new(HookTask), new(Team), new(OrgUser), new(TeamUser), - new(Notice), new(EmailAddress), new(Collaboration)) + new(Notice), new(EmailAddress)) } func LoadModelsConfig() { sec := setting.Cfg.Section("database") DbCfg.Type = sec.Key("DB_TYPE").String() - if DbCfg.Type == "sqlite3" { - UseSQLite3 = true + switch DbCfg.Type { + case "sqlite3": + setting.UseSQLite3 = true + case "mysql": + setting.UseMySQL = true + case "postgres": + setting.UsePostgreSQL = true } DbCfg.Host = sec.Key("HOST").String() DbCfg.Name = sec.Key("NAME").String() @@ -141,7 +146,7 @@ func NewEngine() (err error) { } if err = migrations.Migrate(x); err != nil { - return err + return fmt.Errorf("migrate: %v", err) } if err = x.StoreEngine("InnoDB").Sync2(tables...); err != nil { |