Execute update posts query first (#18524)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
68517a7719
Коммит
b724ba6243
@@ -1294,31 +1294,29 @@ func fixCRTChannelMembershipCounts(sqlStore *SqlStore) {
|
||||
func upgradeDatabaseToVersion600(sqlStore *SqlStore) {
|
||||
// if shouldPerformUpgrade(sqlStore, Version5380, Version600) {
|
||||
|
||||
sqlStore.GetMaster().ExecNoTimeout("UPDATE Posts SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId")
|
||||
if sqlStore.DriverName() == model.DatabaseDriverMysql {
|
||||
if sqlStore.DoesColumnExist("Posts", "ParentId") {
|
||||
sqlStore.GetMaster().ExecNoTimeout("ALTER TABLE Posts MODIFY COLUMN FileIds text, MODIFY COLUMN Props JSON, DROP COLUMN ParentId")
|
||||
} else {
|
||||
sqlStore.GetMaster().ExecNoTimeout("ALTER TABLE Posts MODIFY COLUMN FileIds text, MODIFY COLUMN Props JSON")
|
||||
}
|
||||
} else {
|
||||
sqlStore.AlterColumnTypeIfExists("Posts", "FileIds", "text", "varchar(300)")
|
||||
sqlStore.AlterColumnTypeIfExists("Posts", "Props", "JSON", "jsonb")
|
||||
sqlStore.RemoveColumnIfExists("Posts", "ParentId")
|
||||
}
|
||||
|
||||
sqlStore.AlterColumnTypeIfExists("ChannelMembers", "NotifyProps", "JSON", "jsonb")
|
||||
sqlStore.AlterColumnTypeIfExists("Jobs", "Data", "JSON", "jsonb")
|
||||
sqlStore.AlterColumnTypeIfExists("LinkMetadata", "Data", "JSON", "jsonb")
|
||||
|
||||
if sqlStore.DriverName() == model.DatabaseDriverPostgres {
|
||||
sqlStore.AlterColumnTypeIfExists("Posts", "Props", "JSON", "jsonb")
|
||||
}
|
||||
sqlStore.AlterColumnTypeIfExists("Sessions", "Props", "JSON", "jsonb")
|
||||
sqlStore.AlterColumnTypeIfExists("Threads", "Participants", "JSON", "jsonb")
|
||||
sqlStore.AlterColumnTypeIfExists("Users", "Props", "JSON", "jsonb")
|
||||
sqlStore.AlterColumnTypeIfExists("Users", "NotifyProps", "JSON", "jsonb")
|
||||
sqlStore.AlterColumnTypeIfExists("Users", "Timezone", "JSON", "jsonb")
|
||||
|
||||
sqlStore.GetMaster().ExecNoTimeout("UPDATE Posts SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId")
|
||||
if sqlStore.DriverName() == model.DatabaseDriverPostgres {
|
||||
sqlStore.RemoveColumnIfExists("Posts", "ParentId")
|
||||
}
|
||||
sqlStore.GetMaster().ExecNoTimeout("UPDATE CommandWebhooks SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId")
|
||||
sqlStore.RemoveColumnIfExists("CommandWebhooks", "ParentId")
|
||||
|
||||
@@ -1339,10 +1337,6 @@ func upgradeDatabaseToVersion600(sqlStore *SqlStore) {
|
||||
sqlStore.CreateCompositeIndexIfNotExists("idx_status_status_dndendtime", "Status", []string{"Status", "DNDEndTime"})
|
||||
sqlStore.RemoveIndexIfExists("idx_status_status", "Status")
|
||||
|
||||
if sqlStore.DriverName() == model.DatabaseDriverPostgres {
|
||||
sqlStore.AlterColumnTypeIfExists("Posts", "FileIds", "text", "varchar(300)")
|
||||
}
|
||||
|
||||
// saveSchemaVersion(sqlStore, Version600)
|
||||
// }
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user