Created
September 12, 2013 02:11
-
-
Save droyad/6532392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void RestoreDatabase(Server server) | |
| { | |
| Program.Log("Restoring {0} on {1}".With(_options.Database, _options.Server)); | |
| if (server.Databases[_options.Database] != null) | |
| server.KillAllProcesses(_options.Database); | |
| else | |
| new Database(server, _options.Database).Create(); | |
| var restore = new Restore(); | |
| if (string.IsNullOrEmpty(_options.RestoreFrom)) | |
| { | |
| Program.Log("Restoring {0} from Logical Device FAMS_Initial".With(_options.Database)); | |
| restore.Devices.AddDevice("FAMS_Initial", DeviceType.LogicalDevice); | |
| } | |
| else | |
| { | |
| Program.Log("Restoring {0} from {1}".With(_options.Database, _options.RestoreFrom)); | |
| restore.Devices.AddDevice(_options.RestoreFrom, DeviceType.File); | |
| } | |
| restore.Database = _options.Database; | |
| restore.ReplaceDatabase = true; | |
| restore.SqlRestore(server); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment