private void DeleteDatabaseBackup(Database db, SqlExecutor dbExecutor) { if (!WhatIf) { dbExecutor.Execute(string.Format("DROP DATABASE {0}", db.Name)); } Log.Info("Deleted database {0}.", db.Name); }
private static int GetDay(Database db) { var timestamp = Util.GetDatabaseNameTimestamp(db); var date = Util.GetDateTimeFromTimestamp(timestamp); if (date.Kind != DateTimeKind.Utc) { throw new InvalidDataException("DateTime must be Utc"); } var daysSinceMillenium = (int)date.Subtract(new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalDays; return daysSinceMillenium; }
public static string GetDatabaseNameTimestamp(Database database) { return GetDatabaseNameTimestamp(database.Name); }
private static DateTime GetTimestamp(Database db) { var timestamp = Util.GetDatabaseNameTimestamp(db); var date = Util.GetDateTimeFromTimestamp(timestamp); return date; }