Initial work on fluent database migrations
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Migrations.Model;
|
||||
using ColumnDefinition = Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions.ColumnDefinition;
|
||||
|
||||
namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
{
|
||||
@@ -75,5 +76,34 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
protected override string FormatIdentity(Migrations.Model.ColumnDefinition column)
|
||||
{
|
||||
return column.IsIdentity ? GetIdentityString(column) : string.Empty;
|
||||
}
|
||||
|
||||
private static string GetIdentityString(Migrations.Model.ColumnDefinition column)
|
||||
{
|
||||
return "IDENTITY(1,1)";
|
||||
}
|
||||
|
||||
protected override string FormatSystemMethods(SystemMethods systemMethod)
|
||||
{
|
||||
switch (systemMethod)
|
||||
{
|
||||
case SystemMethods.NewGuid:
|
||||
return "NEWID()";
|
||||
case SystemMethods.NewSequentialId:
|
||||
return "NEWSEQUENTIALID()";
|
||||
case SystemMethods.CurrentDateTime:
|
||||
return "GETDATE()";
|
||||
case SystemMethods.CurrentUTCDateTime:
|
||||
return "GETUTCDATE()";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string AddColumn { get { return "ALTER TABLE {0} ADD {1}"; } }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user