fix: restore rpg creation entry migration helper
This commit is contained in:
@@ -195,6 +195,36 @@ fn seed_creation_entry_config_if_missing(ctx: &ReducerContext) {
|
||||
);
|
||||
}
|
||||
|
||||
fn migrate_rpg_entry_from_old_hidden_default(ctx: &ReducerContext, now: Timestamp) {
|
||||
let id = "rpg".to_string();
|
||||
let Some(row) = ctx.db.creation_entry_type_config().id().find(&id) else {
|
||||
return;
|
||||
};
|
||||
|
||||
// 中文注释:只开放历史默认隐藏的 RPG 入口,不覆盖后台入口开关后续手动配置。
|
||||
let still_old_hidden_default = row.title == "文字冒险"
|
||||
&& row.subtitle == "经典 RPG 体验"
|
||||
&& row.badge == "内测"
|
||||
&& row.image_src == "/creation-type-references/rpg.webp"
|
||||
&& !row.visible
|
||||
&& row.open
|
||||
&& row.sort_order == 10;
|
||||
if !still_old_hidden_default {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.db
|
||||
.creation_entry_type_config()
|
||||
.id()
|
||||
.update(CreationEntryTypeConfig {
|
||||
badge: "可创建".to_string(),
|
||||
visible: true,
|
||||
open: true,
|
||||
updated_at: now,
|
||||
..row
|
||||
});
|
||||
}
|
||||
|
||||
fn migrate_bark_battle_entry_to_open_default(ctx: &ReducerContext, now: Timestamp) {
|
||||
let id = "bark-battle".to_string();
|
||||
let Some(row) = ctx.db.creation_entry_type_config().id().find(&id) else {
|
||||
|
||||
Reference in New Issue
Block a user