提交 0b0bb0b3 编写于 作者: 智能大石头's avatar 智能大石头

日志Log针对Mysql自动使用压缩表,以减少存储空间

上级 0705dc2f
......@@ -22,6 +22,11 @@ public partial class Log : Entity<Log>
// 关闭SQL日志
ThreadPool.UnsafeQueueUserWorkItem(s => { Meta.Session.Dal.Db.ShowSQL = false; }, null);
#endif
// 针对Mysql启用压缩表
var table = Meta.Table.DataTable;
table.Properties["ROW_FORMAT"] = "COMPRESSED";
table.Properties["KEY_BLOCK_SIZE"] = "4";
}
/// <summary>已重载。记录当前管理员</summary>
......
......@@ -434,6 +434,17 @@ public class MySqlTests
dal.SetTables(table);
Assert.Contains(dal.Tables, t => t.TableName == table.TableName);
// Log表自带压缩表能力
table = Log.Meta.Table.DataTable.Clone() as IDataTable;
table.DbType = DatabaseType.MySql;
Assert.Equal("COMPRESSED", table.Properties["ROW_FORMAT"]);
Assert.Equal("4", table.Properties["KEY_BLOCK_SIZE"]);
sql = meta.GetSchemaSQL(DDLSchema.CreateTable, table);
Assert.Contains(" ROW_FORMAT=COMPRESSED", sql);
Assert.Contains(" KEY_BLOCK_SIZE=4", sql);
}
[Fact]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册