public override void Drop() { var databaseLocation = SQLiteConnectionProvider.GetFullDBPath(Settings); log.LogDebug($"Удаление базы данных ({databaseLocation})"); if (!File.Exists(databaseLocation)) { return; } File.Delete(databaseLocation); }
public override void CreateEmptyDB() { var databaseLocation = SQLiteConnectionProvider.GetFullDBPath(Settings); log.LogDebug($"Создание пустой базы данных ({databaseLocation})"); var directoryPath = Path.GetDirectoryName(databaseLocation); if (!string.IsNullOrWhiteSpace(directoryPath)) { Directory.CreateDirectory(directoryPath); } SQLiteConnection.CreateFile(databaseLocation); var createCommandText = GetResourceAsString(GetType(), GetAppropriateCreateScript(Settings)); using (var sqliteConnection = SQLiteConnectionProvider.GetConnectionFromSettings(Settings)) { sqliteConnection.Execute(createCommandText); } }
public override bool DatabaseExists() { var fullDbPath = SQLiteConnectionProvider.GetFullDBPath(Settings); return(File.Exists(fullDbPath)); }