Refine set option to sync v2 & v3

This commit is contained in:
WQY\qiong
2023-03-08 22:18:28 +08:00
parent ca1a065d54
commit 7c9eb1555a
2 changed files with 16 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
from .database import *
from .s23_options_v3 import set_option_v3
from .s23_options_util import generate_v3
@@ -107,8 +108,13 @@ def set_option_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
return execute_command(name, set_option_cmd(name, cs))
def set_option(name: str, cs: ChangeSet, update_v3: bool = True) -> ChangeSet:
v2 = set_option_cmd(name, cs)
result = execute_command(name, v2)
if update_v3:
v3 = generate_v3(ChangeSet(v2.redo_cs[0]))
result.merge(set_option_v3(name, v3, False))
return result
#--------------------------------------------------------------