Skip to content

Commit c487591

Browse files
committed
Rename-DbaDatabase, public beta
1 parent f79d92c commit c487591

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

functions/Rename-DbaDatabase.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Function Rename-DbaDatabase {
22
<#
33
.SYNOPSIS
4-
Changes database name, logical file names, file group names and physical file names (optionally handling the move).
4+
Changes database name, logical file names, file group names and physical file names (optionally handling the move). BETA VERSION.
55
66
.DESCRIPTION
77
Can change every database metadata that can be renamed.
@@ -127,11 +127,9 @@ Function Rename-DbaDatabase {
127127
.NOTES
128128
Author: niphlod
129129
130-
dbatools PowerShell module (https://dbatools.io, clemaire@gmail.com)
131-
Copyright (C) 2016 Chrissy LeMaire
132-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
133-
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
134-
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
130+
Website: https://dbatools.io
131+
Copyright: (C) Chrissy LeMaire, clemaire@gmail.com
132+
License: GNU GPL v3 https://opensource.org/licenses/GPL-3.0
135133
136134
.LINK
137135
https://dbatools.io/Rename-DbaDatabase
@@ -567,7 +565,7 @@ Function Rename-DbaDatabase {
567565
if ( !$InstanceFiles[$Server_Id].ContainsKey($dirname) ) {
568566
$InstanceFiles[$Server_Id][$dirname] = @{}
569567
try {
570-
$dirfiles = Get-DbaFile -SqlInstance $server -Path $dirname -Silent
568+
$dirfiles = Get-DbaFile -SqlInstance $server -Path $dirname -EnableException
571569
}
572570
catch {
573571
Write-Message -Level Warning -Message "Failed to enumerate existing files at $dirname, move could go wrong"
@@ -587,11 +585,6 @@ Function Rename-DbaDatabase {
587585
'FileStreamDataFileGroup' { 'FS' }
588586
default { 'STD' }
589587
}
590-
if ($FileType -in @('FS', 'MMO')) {
591-
## FIXME (do we wanna handle FS and MMO "moving" ? If so, renaming the dir is enough ?? )
592-
Write-Message -Level VeryVerbose -Message "FileStream/MMO moving is not supported ATM, skipping"
593-
continue
594-
}
595588
$FNName = $logical.FileName
596589
$FNNameDir = [IO.Path]::GetDirectoryName($FNName)
597590
$Orig_FNNameLeaf = [IO.Path]::GetFileNameWithoutExtension($logical.FileName)

0 commit comments

Comments
 (0)