Refactoring migrations by adding an abstract class to all expressions that allow for processing prior to returning an sql statement.
Refactoring the current sql syntax providers to better work with sql ce, sql server and mysql. Adding migrations for v4.8 and v6.0. Adding test cases for upgrading from 4.7 to 6.0 for the 3 database providers - sql ce, sql server and mysql. Adding product name to the MigrationAttribute, which adds more flexibility to the MigrationRunner. Fixing schema creation for mysql, which broke during a previous refactor task.
This commit is contained in:
@@ -76,12 +76,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
|
||||
public override string FormatColumnRename(string tableName, string oldName, string newName)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
//NOTE Sql CE doesn't support renaming a column, so a new column needs to be created, then copy data and finally remove old column
|
||||
//This assumes that the new column has been created, and that the old column will be deleted after this statement has run.
|
||||
//http://stackoverflow.com/questions/3967353/microsoft-sql-compact-edition-rename-column
|
||||
//Create new column
|
||||
sb.AppendFormat("UPDATE {0} SET {1} = {2}", tableName, newName, oldName);
|
||||
//Delete old column
|
||||
return sb.ToString();
|
||||
|
||||
return string.Format("UPDATE {0} SET {1} = {2}", tableName, newName, oldName);
|
||||
}
|
||||
|
||||
public override string FormatTableRename(string oldName, string newName)
|
||||
@@ -153,7 +152,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
{
|
||||
get
|
||||
{
|
||||
return "ALTER TABLE {0} ALTER COLUMN {1} DROP DEFAULT";
|
||||
return "ALTER TABLE [{0}] ALTER COLUMN [{1}] DROP DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user