Skip to content

Commit c0c8d40

Browse files
committed
- Add core developer tool RockDB Backup Manager to allow easy and quick database Backup and Restore
1 parent 9965297 commit c0c8d40

File tree

10 files changed

+697
-0
lines changed

10 files changed

+697
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
5+
<section name="RockDbBackupManager.BackupManager" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
6+
</sectionGroup>
7+
</configSections>
8+
<userSettings>
9+
<RockDbBackupManager.BackupManager>
10+
<setting name="BackupDirectory" serializeAs="String">
11+
<value>C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup\</value>
12+
</setting>
13+
<setting name="IsWarningOnRestore" serializeAs="String">
14+
<value>True</value>
15+
</setting>
16+
</RockDbBackupManager.BackupManager>
17+
</userSettings>
18+
</configuration>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="RockDbBackupManager.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:RockDbBackupManager"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// <copyright>
2+
// Copyright by the Spark Development Network
3+
//
4+
// Licensed under the Rock Community License (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.rockrms.com/license
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// </copyright>
16+
17+
namespace RockDbBackupManager
18+
{
19+
/// <summary>
20+
/// Interaction logic for App.xaml
21+
/// </summary>
22+
public partial class App : System.Windows.Application
23+
{
24+
}
25+
26+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

Dev Tools/RockDbBackupManager/BackupManager.Designer.cs

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="RockDbBackupManager" GeneratedClassName="BackupManager">
3+
<Profiles />
4+
<Settings>
5+
<Setting Name="BackupDirectory" Type="System.String" Scope="User">
6+
<Value Profile="(Default)">C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup\</Value>
7+
</Setting>
8+
<Setting Name="IsWarningOnRestore" Type="System.Boolean" Scope="User">
9+
<Value Profile="(Default)">True</Value>
10+
</Setting>
11+
</Settings>
12+
</SettingsFile>
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<!--
2+
//<copyright>
3+
// Copyright by the Spark Development Network
4+
//
5+
// Licensed under the Rock Community License (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.rockrms.com/license
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
//</copyright>
17+
-->
18+
<Window x:Class="RockDbBackupManager.MainWindow"
19+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
20+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
21+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
22+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
23+
xmlns:local="clr-namespace:RockDbBackupManager"
24+
mc:Ignorable="d"
25+
Title="RockDB Backup Manager" Height="435" Width="965" MinHeight="565" MinWidth="965">
26+
<DockPanel>
27+
<Menu DockPanel.Dock="Top">
28+
<Menu.ItemsPanel>
29+
<ItemsPanelTemplate>
30+
<DockPanel HorizontalAlignment="Stretch"/>
31+
</ItemsPanelTemplate>
32+
</Menu.ItemsPanel>
33+
<MenuItem Header="File">
34+
<MenuItem Header="Exit" Click="ExitMenuItem_Click"/>
35+
</MenuItem>
36+
<MenuItem Header="Reset">
37+
<MenuItem Header="Reset 'Restore Database' Warning" Click="RestoreWarningMenuItem_Click"/>
38+
</MenuItem>
39+
<MenuItem Header="Help" HorizontalAlignment="Right">
40+
<MenuItem Header="About RockDB Backup Manager" Click="AboutMenuItem_Click"/>
41+
</MenuItem>
42+
</Menu>
43+
<Grid Margin="20">
44+
<Grid.RowDefinitions>
45+
<RowDefinition Height="Auto"/>
46+
<RowDefinition Height="Auto"/>
47+
<RowDefinition Height="*"/>
48+
<RowDefinition Height="Auto"/>
49+
</Grid.RowDefinitions>
50+
<Grid.ColumnDefinitions>
51+
<ColumnDefinition Width="*"/>
52+
</Grid.ColumnDefinitions>
53+
54+
<!-- Shared Controls -->
55+
<Grid Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,10">
56+
<Grid.ColumnDefinitions>
57+
<ColumnDefinition Width="Auto"/>
58+
<ColumnDefinition Width="Auto"/>
59+
<ColumnDefinition Width="Auto"/>
60+
<ColumnDefinition Width="*"/>
61+
<ColumnDefinition Width="Auto"/>
62+
<ColumnDefinition Width="Auto"/>
63+
</Grid.ColumnDefinitions>
64+
<TextBlock Grid.Column="0" Text="Database:" VerticalAlignment="Center" Margin="0,0,10,0"/>
65+
<ComboBox Grid.Column="1" x:Name="DatabaseNameComboBox" Width="150" Margin="0,0,20,0" SelectionChanged="DatabaseNameComboBox_SelectionChanged"/>
66+
<TextBlock Grid.Column="2" Text="Backup Directory:" VerticalAlignment="Center" Margin="0,0,10,0"/>
67+
<TextBox Grid.Column="3" x:Name="BackupDirectoryTextBox" IsReadOnly="True" Text="C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup\"/>
68+
<Button Grid.Column="4"
69+
Width="24"
70+
Height="24"
71+
Margin="10,0,0,0"
72+
Padding="0"
73+
Background="Transparent"
74+
BorderThickness="0"
75+
BorderBrush="Transparent"
76+
Focusable="False"
77+
ToolTip="The directory where your database backups will be stored. You can change this to any folder, however, the SQL Server service account (typically NT SERVICE\MSSQLSERVER) must have write access to this directory, or backups will fail.">
78+
<TextBlock Text="?" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/>
79+
</Button>
80+
<Button Grid.Column="5" x:Name="BrowseBackupDirectoryButton" Content="Browse..." Width="80" Margin="10,0,0,0" Click="BrowseBackupDirectoryButton_Click"/>
81+
</Grid>
82+
83+
<!-- Backup Controls (Top) -->
84+
<GroupBox Header="Backup" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10">
85+
<StackPanel>
86+
<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
87+
<TextBlock Text="Additional Tags:" VerticalAlignment="Center" Margin="0,0,10,0"/>
88+
<TextBox x:Name="AdditionalTagsTextBox" Width="200"/>
89+
<Button Width="24" Height="24" Margin="10,0,0,0" Padding="0"
90+
Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Focusable="False"
91+
ToolTip="Comma separated tags to add to the backup filename. Only alphanumeric characters are used. For example, 'clean, migrated' will result in a filename like yyyy_MM_dd_HHmmss_dbName_clean_migrated.bak. Note: All non-alphanumeric characters, including whitespace, are removed.">
92+
<TextBlock Text="?" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/>
93+
</Button>
94+
</StackPanel>
95+
<Button x:Name="BackupButton" Content="Backup Selected Database" Width="150" Margin="0,10,0,10" Click="BackupButton_Click"/>
96+
</StackPanel>
97+
</GroupBox>
98+
99+
<!-- Restore Controls (Bottom) -->
100+
<GroupBox Header="Restore" Grid.Row="2" Grid.Column="0" Margin="0,0,0,0">
101+
<Grid Margin="20,0,20,0">
102+
<Grid.RowDefinitions>
103+
<RowDefinition Height="Auto"/>
104+
<RowDefinition Height="*"/>
105+
<RowDefinition Height="Auto"/>
106+
<RowDefinition Height="Auto"/>
107+
</Grid.RowDefinitions>
108+
<TextBlock Grid.Row="0" Text="Available Backups:" Margin="0,0,0,5"/>
109+
<ListBox Grid.Row="1" x:Name="BackupFilesListBox"
110+
MinHeight="120"
111+
VerticalAlignment="Stretch"
112+
Height="Auto"
113+
SelectionChanged="BackupFilesListBox_SelectionChanged">
114+
<ListBox.ItemTemplate>
115+
<DataTemplate>
116+
<StackPanel Orientation="Horizontal">
117+
<TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="0,0,10,0"/>
118+
<Button Content="X" Width="24" Height="24" Padding="0" Margin="0,0,0,0"
119+
Background="Transparent" BorderThickness="0" BorderBrush="Transparent"
120+
Focusable="False" Click="DeleteBackupButton_Click"
121+
Tag="{Binding}"/>
122+
</StackPanel>
123+
</DataTemplate>
124+
</ListBox.ItemTemplate>
125+
</ListBox>
126+
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,10,0,0">
127+
<TextBox x:Name="RestoreFileTextBox" Width="200" IsReadOnly="True"/>
128+
<Button x:Name="BrowseRestoreFileButton" Content="Browse..." Width="80" Margin="10,0,0,0" Click="BrowseRestoreFileButton_Click"/>
129+
</StackPanel>
130+
<Button Grid.Row="4" x:Name="RestoreButton" Content="Restore Database" Width="150" Margin="0,10,0,0" Click="RestoreButton_Click"/>
131+
</Grid>
132+
</GroupBox>
133+
134+
<!-- Status -->
135+
<TextBlock x:Name="StatusTextBlock" Grid.Row="3" Grid.Column="0" Margin="0,20,0,0" Foreground="DarkGreen" HorizontalAlignment="Stretch" TextWrapping="Wrap"/>
136+
</Grid>
137+
</DockPanel>
138+
</Window>

0 commit comments

Comments
 (0)