You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
613 B
32 lines
613 B
using System.Text;
|
|
|
|
namespace Connected.Data.Schema.Sql
|
|
{
|
|
internal class TableRename : TableTransaction
|
|
{
|
|
public TableRename(string temporaryName)
|
|
{
|
|
TemporaryName = temporaryName;
|
|
}
|
|
|
|
private string TemporaryName { get; }
|
|
|
|
protected override async Task OnExecute()
|
|
{
|
|
await Context.Execute(CommandText);
|
|
}
|
|
|
|
private string CommandText
|
|
{
|
|
get
|
|
{
|
|
var text = new StringBuilder();
|
|
|
|
text.AppendLine($"EXECUTE sp_rename N'{Unescape(Context.Schema.SchemaName())}.{Unescape(TemporaryName)}', N'{Unescape(Context.Schema.Name)}', 'OBJECT'");
|
|
|
|
return text.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|