Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加业务低峰时间范围,ddl只能够在在业务低峰执行选项,避免非dba执行sql锁表影响业务 #2731

Closed
wants to merge 8 commits into from
Prev Previous commit
Next Next commit
添加数据库变更sql
woshiyanghai committed Jan 24, 2025
commit d54135513c8b5bc3de211cc13dd023b8db21f76f
3 changes: 3 additions & 0 deletions sql/models.py
Original file line number Diff line number Diff line change
@@ -184,6 +184,9 @@ def validate_peak_time_period(value):
验证 peak_time_period 格式是否正确。
格式示例: "14:00-14:50,15:00-16:00"
"""
if value is None or value == "":
return

time_period_regex = r"^(\d{2}:\d{2}-\d{2}:\d{2})(,\d{2}:\d{2}-\d{2}:\d{2})*$"
if not re.match(time_period_regex, value):
raise ValidationError(
1 change: 1 addition & 0 deletions src/init_sql/v1.11.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE sql_instance ADD COLUMN peak_time_period VARCHAR(255);