Fix attribute template column name: display_order -> sort_order

This commit is contained in:
OpenClaw Bot
2026-02-20 00:14:37 +08:00
parent fcb09a4442
commit ffbf0df3ce

View File

@@ -51,7 +51,7 @@ class AttributeTemplate:
default_value: str = "" default_value: str = ""
description: str = "" description: str = ""
is_required: bool = False is_required: bool = False
display_order: int = 0 sort_order: int = 0
created_at: str = "" created_at: str = ""
updated_at: str = "" updated_at: str = ""
@@ -655,12 +655,12 @@ class DatabaseManager:
now = datetime.now().isoformat() now = datetime.now().isoformat()
conn.execute( conn.execute(
"""INSERT INTO attribute_templates """INSERT INTO attribute_templates
(id, project_id, name, type, options, default_value, description, is_required, display_order, created_at, updated_at) (id, project_id, name, type, options, default_value, description, is_required, sort_order, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(template.id, template.project_id, template.name, template.type, (template.id, template.project_id, template.name, template.type,
json.dumps(template.options) if template.options else None, json.dumps(template.options) if template.options else None,
template.default_value, template.description, template.is_required, template.default_value, template.description, template.is_required,
template.display_order, now, now) template.sort_order, now, now)
) )
conn.commit() conn.commit()
conn.close() conn.close()
@@ -680,7 +680,7 @@ class DatabaseManager:
conn = self.get_conn() conn = self.get_conn()
rows = conn.execute( rows = conn.execute(
"""SELECT * FROM attribute_templates WHERE project_id = ? """SELECT * FROM attribute_templates WHERE project_id = ?
ORDER BY display_order, created_at""", ORDER BY sort_order, created_at""",
(project_id,) (project_id,)
).fetchall() ).fetchall()
conn.close() conn.close()
@@ -694,7 +694,7 @@ class DatabaseManager:
def update_attribute_template(self, template_id: str, **kwargs) -> Optional[AttributeTemplate]: def update_attribute_template(self, template_id: str, **kwargs) -> Optional[AttributeTemplate]:
conn = self.get_conn() conn = self.get_conn()
allowed_fields = ['name', 'type', 'options', 'default_value', 'description', 'is_required', 'display_order'] allowed_fields = ['name', 'type', 'options', 'default_value', 'description', 'is_required', 'sort_order']
updates = [] updates = []
values = [] values = []