Making changes to versioning
Этот коммит содержится в:
@@ -196,9 +196,9 @@ func (s SqlPostStore) GetEtag(channelId string) StoreChannel {
|
||||
var et etagPosts
|
||||
err := s.GetReplica().SelectOne(&et, "SELECT Id, UpdateAt FROM Posts WHERE ChannelId = :ChannelId ORDER BY UpdateAt DESC LIMIT 1", map[string]interface{}{"ChannelId": channelId})
|
||||
if err != nil {
|
||||
result.Data = fmt.Sprintf("%v.0.%v", model.GetFullVersion(), model.GetMillis())
|
||||
result.Data = fmt.Sprintf("%v.0.%v", model.CurrentVersion, model.GetMillis())
|
||||
} else {
|
||||
result.Data = fmt.Sprintf("%v.%v.%v", model.GetFullVersion(), et.Id, et.UpdateAt)
|
||||
result.Data = fmt.Sprintf("%v.%v.%v", model.CurrentVersion, et.Id, et.UpdateAt)
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
|
||||
@@ -37,14 +37,14 @@ func TestPostStoreGet(t *testing.T) {
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
|
||||
etag1 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
|
||||
if strings.Index(etag1, model.GetFullVersion()+".0.") != 0 {
|
||||
if strings.Index(etag1, model.CurrentVersion+".0.") != 0 {
|
||||
t.Fatal("Invalid Etag")
|
||||
}
|
||||
|
||||
o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
|
||||
|
||||
etag2 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
|
||||
if strings.Index(etag2, model.GetFullVersion()+"."+o1.Id) != 0 {
|
||||
if strings.Index(etag2, model.CurrentVersion+"."+o1.Id) != 0 {
|
||||
t.Fatal("Invalid Etag")
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ func TestPostStoreDelete(t *testing.T) {
|
||||
o1.Message = "a" + model.NewId() + "b"
|
||||
|
||||
etag1 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
|
||||
if strings.Index(etag1, model.GetFullVersion()+".0.") != 0 {
|
||||
if strings.Index(etag1, model.CurrentVersion+".0.") != 0 {
|
||||
t.Fatal("Invalid Etag")
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ func TestPostStoreDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
etag2 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
|
||||
if strings.Index(etag2, model.GetFullVersion()+"."+o1.Id) != 0 {
|
||||
if strings.Index(etag2, model.CurrentVersion+"."+o1.Id) != 0 {
|
||||
t.Fatal("Invalid Etag")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ func NewSqlStore() Store {
|
||||
// Check to see if it's the most current database schema version
|
||||
if !model.IsCurrentVersion(schemaVersion) {
|
||||
// If we are upgrading from the previous version then print a warning and continue
|
||||
if model.IsLastVersion(schemaVersion) {
|
||||
if model.IsPreviousVersion(schemaVersion) {
|
||||
l4g.Warn("The database schema version of " + schemaVersion + " appears to be out of date")
|
||||
l4g.Warn("Attempting to upgrade the database schema version to " + model.GetFullVersion())
|
||||
l4g.Warn("Attempting to upgrade the database schema version to " + model.CurrentVersion)
|
||||
} else {
|
||||
// If this is an 'upgrade needed' state but the user is attempting to skip a version then halt the world
|
||||
l4g.Critical("The database schema version of " + schemaVersion + " cannot be upgraded. You must not skip a version.")
|
||||
@@ -112,14 +112,14 @@ func NewSqlStore() Store {
|
||||
sqlStore.oauth.(*SqlOAuthStore).CreateIndexesIfNotExists()
|
||||
sqlStore.system.(*SqlSystemStore).CreateIndexesIfNotExists()
|
||||
|
||||
if model.IsLastVersion(schemaVersion) {
|
||||
sqlStore.system.Update(&model.System{Name: "Version", Value: model.GetFullVersion()})
|
||||
l4g.Warn("The database schema has been upgraded to version " + model.GetFullVersion())
|
||||
if model.IsPreviousVersion(schemaVersion) {
|
||||
sqlStore.system.Update(&model.System{Name: "Version", Value: model.CurrentVersion})
|
||||
l4g.Warn("The database schema has been upgraded to version " + model.CurrentVersion)
|
||||
}
|
||||
|
||||
if schemaVersion == "" {
|
||||
sqlStore.system.Save(&model.System{Name: "Version", Value: model.GetFullVersion()})
|
||||
l4g.Info("The database schema has been set to version " + model.GetFullVersion())
|
||||
sqlStore.system.Save(&model.System{Name: "Version", Value: model.CurrentVersion})
|
||||
l4g.Info("The database schema has been set to version " + model.CurrentVersion)
|
||||
}
|
||||
|
||||
return sqlStore
|
||||
|
||||
@@ -325,9 +325,9 @@ func (s SqlUserStore) GetEtagForProfiles(teamId string) StoreChannel {
|
||||
|
||||
updateAt, err := s.GetReplica().SelectInt("SELECT UpdateAt FROM Users WHERE TeamId = :TeamId ORDER BY UpdateAt DESC LIMIT 1", map[string]interface{}{"TeamId": teamId})
|
||||
if err != nil {
|
||||
result.Data = fmt.Sprintf("%v.%v", model.GetFullVersion(), model.GetMillis())
|
||||
result.Data = fmt.Sprintf("%v.%v", model.CurrentVersion, model.GetMillis())
|
||||
} else {
|
||||
result.Data = fmt.Sprintf("%v.%v", model.GetFullVersion(), updateAt)
|
||||
result.Data = fmt.Sprintf("%v.%v", model.CurrentVersion, updateAt)
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
|
||||
Ссылка в новой задаче
Block a user