add a sort order to topics for the future

This commit is contained in:
2025-05-22 02:57:25 +03:00
parent 9438d3704b
commit 7f10dde1ea
2 changed files with 9 additions and 0 deletions

View File

@ -57,5 +57,10 @@ return {
db.query('DROP INDEX "idx_users_avatar"')
schema.drop_column("users", "avatar_id")
schema.add_column("users", "avatar_id", "REFERENCES avatars(id) DEFAULT 1")
end,
[8] = function ()
schema.add_column("topics", "sort_order", types.integer{default = 0})
db.query("UPDATE topics SET sort_order = (SELECT COUNT(*) FROM topics t2 WHERE t2.ROWID <= topics.ROWID)")
end
}