Skip to content

Commit

Permalink
fix(sqlserver): sqlserver dts_mode、批量查询单据、新机重建单据详情添加clusters #6516
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 16757
  • Loading branch information
ygcyao authored and iSecloud committed Aug 29, 2024
1 parent 721f3a0 commit 980fd9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,23 @@ def validate(self, attrs):
rename_infos = serializers.ListSerializer(help_text=_("迁移DB信息"), child=RenameInfoSerializer())
dts_id = serializers.IntegerField(help_text=_("迁移记录ID"), required=False)

dts_mode = serializers.ChoiceField(help_text=_("迁移方式"), choices=SqlserverDtsMode.get_choices())
need_auto_rename = serializers.BooleanField(help_text=_("迁移后,系统是否对源DB进行重命名"))
manual_terminate = serializers.BooleanField(help_text=_("手动终止迁移"), required=False, default=False)
infos = serializers.ListSerializer(help_text=_("迁移信息列表"), child=DataMigrateInfoSerializer())

def validate(self, attrs):
"""验证库表数据库的数据"""
# TODO: 根据单据类型固定迁移方式
# TODO: 验证target_db_name如果在目标集群存在,则rename_db_name不为空
# TODO: 验证所有的rename_db_name一定不在目标集群存在
ticket_type = self.context["ticket_type"]
if ticket_type == TicketType.SQLSERVER_FULL_MIGRATE:
attrs["dts_mode"] = SqlserverDtsMode.FULL
elif ticket_type == TicketType.SQLSERVER_INCR_MIGRATE:
attrs["dts_mode"] = SqlserverDtsMode.INCR
else:
raise ValueError("Unknown ticket type")

super().validate(attrs)
# 校验集群是否可用
super().validate_cluster_can_access(attrs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ def patch_ticket_detail(self):
info["system_version"] = db_config["system_version"].split(",")

# 添加集群信息
self.patch_cluster_details()
super().patch_ticket_detail()
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TicketViewSet(viewsets.AuditedModelViewSet):
queryset = Ticket.objects.all()
serializer_class = TicketSerializer
filter_fields = {
"id": ["exact"],
"id": ["exact", "in"],
"bk_biz_id": ["exact"],
"ticket_type": ["exact", "in"],
"status": ["exact", "in"],
Expand Down

0 comments on commit 980fd9c

Please sign in to comment.