IDbMaintenance.cs 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SqlSugar
  6. {
  7. public partial interface IDbMaintenance
  8. {
  9. SqlSugarProvider Context { get; set; }
  10. #region DML
  11. List<string> GetDataBaseList(SqlSugarClient db);
  12. List<string> GetDataBaseList();
  13. List<DbTableInfo> GetViewInfoList(bool isCache=true);
  14. List<DbTableInfo> GetTableInfoList(bool isCache=true);
  15. List<DbColumnInfo> GetColumnInfosByTableName(string tableName,bool isCache=true);
  16. List<string> GetIsIdentities(string tableName);
  17. List<string> GetPrimaries(string tableName);
  18. List<string> GetProcList(string dbName);
  19. List<string> GetIndexList(string tableName);
  20. List<string> GetFuncList();
  21. List<string> GetTriggerNames(string tableName);
  22. List<string> GetDbTypes();
  23. #endregion
  24. #region Check
  25. bool IsAnyTable(string tableName, bool isCache = true);
  26. bool IsAnyColumn(string tableName, string column, bool isCache = true);
  27. bool IsPrimaryKey(string tableName, string column);
  28. bool IsPrimaryKey(string tableName, string column,bool isCache=true);
  29. bool IsIdentity(string tableName, string column);
  30. bool IsAnyConstraint(string ConstraintName);
  31. bool IsAnySystemTablePermissions();
  32. bool IsAnyProcedure(string procName);
  33. #endregion
  34. #region DDL
  35. bool AddDefaultValue(string tableName,string columnName,string defaultValue);
  36. bool CreateIndex(string tableName, string [] columnNames, bool isUnique=false);
  37. bool CreateIndex(string tableName, string[] columnNames, string IndexName, bool isUnique = false);
  38. bool DropTable(string tableName);
  39. bool DropView(string viewName);
  40. bool DropIndex(string indexName);
  41. bool DropFunction(string funcName);
  42. bool DropProc(string procName);
  43. bool DropTable(params string[] tableName);
  44. bool DropTable(params Type[] tableEntityTypes);
  45. bool DropTable<T>();
  46. bool DropTable<T,T2>();
  47. bool DropTable<T, T2,T3>();
  48. bool DropTable<T, T2, T3,T4>();
  49. bool TruncateTable(string tableName);
  50. bool TruncateTable(params string[] tableName);
  51. bool TruncateTable(params Type[] tableEntityType);
  52. bool TruncateTable<T>();
  53. bool TruncateTable<T,T2>();
  54. bool TruncateTable<T, T2, T3>();
  55. bool TruncateTable<T, T2, T3,T4>();
  56. bool TruncateTable<T, T2, T3, T4,T5>();
  57. bool CreateTable(string tableName, List<DbColumnInfo> columns,bool isCreatePrimaryKey=true);
  58. bool AddColumn(string tableName, DbColumnInfo column);
  59. bool UpdateColumn(string tableName, DbColumnInfo column);
  60. bool AddPrimaryKey(string tableName,string columnName);
  61. bool AddPrimaryKeys(string tableName, string [] columnNames);
  62. bool AddPrimaryKeys(string tableName, string[] columnNames,string pkName);
  63. bool DropConstraint(string tableName, string constraintName);
  64. bool BackupDataBase(string databaseName,string fullFileName);
  65. bool BackupTable(string oldTableName, string newTableName, int maxBackupDataRows = int.MaxValue);
  66. bool DropColumn(string tableName,string columnName);
  67. bool RenameColumn(string tableName, string oldColumnName, string newColumnName);
  68. bool AddRemark(EntityInfo entity);
  69. void AddIndex(EntityInfo entityInfo);
  70. void AddDefaultValue(EntityInfo entityInfo);
  71. bool IsAnyDefaultValue(string tableName, string columnName);
  72. bool IsAnyIndex(string indexName);
  73. bool AddColumnRemark(string columnName,string tableName,string description);
  74. bool DeleteColumnRemark(string columnName, string tableName);
  75. bool IsAnyColumnRemark(string columnName, string tableName);
  76. bool AddTableRemark( string tableName, string description);
  77. bool DeleteTableRemark(string tableName);
  78. bool IsAnyTableRemark(string tableName);
  79. bool RenameTable(string oldTableName,string newTableName);
  80. /// <summary>
  81. ///by current connection string
  82. /// </summary>
  83. /// <param name="databaseDirectory"></param>
  84. /// <returns></returns>
  85. bool CreateDatabase(string databaseDirectory = null);
  86. /// <summary>
  87. /// by databaseName
  88. /// </summary>
  89. /// <param name="databaseName"></param>
  90. /// <param name="databaseDirectory"></param>
  91. /// <returns></returns>
  92. bool CreateDatabase(string databaseName,string databaseDirectory = null);
  93. #endregion
  94. }
  95. }