PLT-1765 allowing support of 2 previous versions
Этот коммит содержится в:
@@ -38,6 +38,11 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore {
|
||||
}
|
||||
|
||||
func (s SqlPostStore) UpgradeSchemaIfNeeded() {
|
||||
// ADDED for 1.3 REMOVE for 1.6
|
||||
s.RemoveColumnIfExists("Posts", "ImgCount")
|
||||
|
||||
// ADDED for 1.3 REMOVE for 1.6
|
||||
s.GetMaster().Exec(`UPDATE Preferences SET Type = :NewType WHERE Type = :CurrentType`, map[string]string{"NewType": model.POST_JOIN_LEAVE, "CurrentType": "join_leave"})
|
||||
}
|
||||
|
||||
func (s SqlPostStore) CreateIndexesIfNotExists() {
|
||||
|
||||
@@ -73,25 +73,13 @@ func NewSqlStore() Store {
|
||||
}
|
||||
|
||||
schemaVersion := sqlStore.GetCurrentSchemaVersion()
|
||||
isSchemaVersion07 := false // REMOVE AFTER 1.2 SHIP see PLT-828
|
||||
isSchemaVersion10 := false // REMOVE AFTER 1.2 SHIP see PLT-828
|
||||
|
||||
// If the version is already set then we are potentially in an 'upgrade needed' state
|
||||
if schemaVersion != "" {
|
||||
// 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
|
||||
|
||||
// Special case
|
||||
if schemaVersion == "0.7.1" || schemaVersion == "0.7.0" {
|
||||
isSchemaVersion07 = true
|
||||
}
|
||||
|
||||
if schemaVersion == "1.0.0" {
|
||||
isSchemaVersion10 = true
|
||||
}
|
||||
|
||||
if model.IsPreviousVersion(schemaVersion) || isSchemaVersion07 || isSchemaVersion10 {
|
||||
if model.IsPreviousVersionsSupported(schemaVersion) {
|
||||
l4g.Warn(utils.T("store.sql.schema_out_of_date.warn"), schemaVersion)
|
||||
l4g.Warn(utils.T("store.sql.schema_upgrade_attempt.warn"), model.CurrentVersion)
|
||||
} else {
|
||||
@@ -103,13 +91,6 @@ func NewSqlStore() Store {
|
||||
}
|
||||
}
|
||||
|
||||
// REMOVE AFTER 1.2 SHIP see PLT-828
|
||||
if sqlStore.DoesTableExist("Sessions") {
|
||||
if sqlStore.DoesColumnExist("Sessions", "AltId") {
|
||||
sqlStore.GetMaster().Exec("DROP TABLE IF EXISTS Sessions")
|
||||
}
|
||||
}
|
||||
|
||||
sqlStore.team = NewSqlTeamStore(sqlStore)
|
||||
sqlStore.channel = NewSqlChannelStore(sqlStore)
|
||||
sqlStore.post = NewSqlPostStore(sqlStore)
|
||||
@@ -150,7 +131,7 @@ func NewSqlStore() Store {
|
||||
|
||||
sqlStore.preference.(*SqlPreferenceStore).DeleteUnusedFeatures()
|
||||
|
||||
if model.IsPreviousVersion(schemaVersion) || isSchemaVersion07 || isSchemaVersion10 {
|
||||
if model.IsPreviousVersionsSupported(schemaVersion) {
|
||||
sqlStore.system.Update(&model.System{Name: "Version", Value: model.CurrentVersion})
|
||||
l4g.Warn(utils.T("store.sql.upgraded.warn"), model.CurrentVersion)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
|
||||
}
|
||||
|
||||
func (us SqlUserStore) UpgradeSchemaIfNeeded() {
|
||||
us.CreateColumnIfNotExists("Users", "Locale", "varchar(5)", "character varying(5)", model.DEFAULT_LOCALE) // Added After 1.4
|
||||
// ADDED for 1.5 REMOVE for 1.8
|
||||
us.CreateColumnIfNotExists("Users", "Locale", "varchar(5)", "character varying(5)", model.DEFAULT_LOCALE)
|
||||
}
|
||||
|
||||
func (us SqlUserStore) CreateIndexesIfNotExists() {
|
||||
|
||||
Ссылка в новой задаче
Block a user