Skip to content

Commit

Permalink
删表时回退10年,避免有些表无意间创建
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Aug 2, 2024
1 parent 2835e77 commit e4bbb8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Stardust.Server/Services/ShardTableService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void DoShardTable(Object state)
var tables = dal.Tables;
var tnames = tables.Select(e => e.TableName).ToArray();

for (var dt = today.AddYears(-1); dt < endday; dt = dt.AddDays(1))
for (var dt = today.AddYears(-10); dt < endday; dt = dt.AddDays(1))
{
var name = $"SampleData_{dt:yyyyMMdd}";
if (name.EqualIgnoreCase(tnames))
Expand Down Expand Up @@ -87,7 +87,7 @@ private void DoShardTable(Object state)
// 数据迁移后,原库数据表需要清理。需要重新获取表名列表,因为Stardust/StardustData可能指向同一个数据库
dal2.Tables = null;
var tnames2 = dal2.Tables.Select(e => e.TableName).ToArray();
for (var dt = today.AddYears(-1); dt < endday; dt = dt.AddDays(1))
for (var dt = today.AddYears(-10); dt < endday; dt = dt.AddDays(1))
{
var name = $"SampleData_{dt:yyyyMMdd}";
if (name.EqualIgnoreCase(tnames2))
Expand Down

0 comments on commit e4bbb8a

Please sign in to comment.