mirror of https://github.com/abpframework/abp.git
73 changed files with 5220 additions and 4980 deletions
@ -0,0 +1,25 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Concurrent; |
||||
|
|
||||
|
namespace Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
public abstract class CachedServiceProviderBase |
||||
|
{ |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
private readonly ConcurrentDictionary<Type, Lazy<object>> _cachedServices; |
||||
|
|
||||
|
protected CachedServiceProviderBase(IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
_serviceProvider = serviceProvider; |
||||
|
_cachedServices = new ConcurrentDictionary<Type, Lazy<object>>(); |
||||
|
_cachedServices.TryAdd(typeof(IServiceProvider), new Lazy<object>(() => this)); |
||||
|
} |
||||
|
|
||||
|
public object GetService(Type serviceType) |
||||
|
{ |
||||
|
return _cachedServices.GetOrAdd( |
||||
|
serviceType, |
||||
|
_ => new Lazy<object>(() => _serviceProvider.GetService(serviceType)) |
||||
|
).Value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Provides services by caching the resolved services.
|
||||
|
/// It caches all type of services including transients.
|
||||
|
/// This service's lifetime is transient.
|
||||
|
/// <see cref="ICachedServiceProvider"/> for the one with scoped lifetime.
|
||||
|
/// </summary>
|
||||
|
public interface ITransientCachedServiceProvider : IServiceProvider |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
[ExposeServices(typeof(ITransientCachedServiceProvider))] |
||||
|
public class TransientCachedServiceProvider : |
||||
|
CachedServiceProviderBase, |
||||
|
ITransientCachedServiceProvider, |
||||
|
ITransientDependency |
||||
|
{ |
||||
|
public TransientCachedServiceProvider(IServiceProvider serviceProvider) |
||||
|
: base(serviceProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,102 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Shouldly; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Testing.Utils; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
public class CachedServiceProvider_Tests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void CachedServiceProvider_Should_Cache_Services() |
||||
|
{ |
||||
|
void TestResolvingServices(IServiceScope scope) |
||||
|
{ |
||||
|
var cachedServiceProvider1 = scope.ServiceProvider.GetRequiredService<ICachedServiceProvider>(); |
||||
|
var cachedServiceProvider2 = scope.ServiceProvider.GetRequiredService<ICachedServiceProvider>(); |
||||
|
cachedServiceProvider1.ShouldBeSameAs(cachedServiceProvider2); |
||||
|
|
||||
|
var transientTestService1 = cachedServiceProvider1.GetRequiredService<TransientTestService>(); |
||||
|
var transientTestService2 = cachedServiceProvider2.GetRequiredService<TransientTestService>(); |
||||
|
transientTestService1.ShouldBeSameAs(transientTestService2); |
||||
|
} |
||||
|
|
||||
|
using (var application = AbpApplicationFactory.Create<TestModule>()) |
||||
|
{ |
||||
|
application.Initialize(); |
||||
|
|
||||
|
using (var scope1 = application.ServiceProvider.CreateScope()) |
||||
|
{ |
||||
|
TestResolvingServices(scope1); |
||||
|
var testCounter = scope1.ServiceProvider.GetRequiredService<ITestCounter>(); |
||||
|
testCounter.GetValue(nameof(TransientTestService)).ShouldBe(1); |
||||
|
} |
||||
|
|
||||
|
using (var scope2 = application.ServiceProvider.CreateScope()) |
||||
|
{ |
||||
|
TestResolvingServices(scope2); |
||||
|
var testCounter = scope2.ServiceProvider.GetRequiredService<ITestCounter>(); |
||||
|
|
||||
|
//Resolved in a different scope, so should not cache the service!
|
||||
|
testCounter.GetValue(nameof(TransientTestService)).ShouldBe(2); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void TransientCachedServiceProvider_Should_Cache_Services() |
||||
|
{ |
||||
|
void TestResolvingServices(IServiceScope scope) |
||||
|
{ |
||||
|
var cachedServiceProvider1 = scope.ServiceProvider.GetRequiredService<ITransientCachedServiceProvider>(); |
||||
|
|
||||
|
var transientTestService1_1 = cachedServiceProvider1.GetRequiredService<TransientTestService>(); |
||||
|
var transientTestService1_2 = cachedServiceProvider1.GetRequiredService<TransientTestService>(); |
||||
|
transientTestService1_1.ShouldBeSameAs(transientTestService1_2); |
||||
|
|
||||
|
var cachedServiceProvider2 = scope.ServiceProvider.GetRequiredService<ITransientCachedServiceProvider>(); |
||||
|
cachedServiceProvider1.ShouldNotBeSameAs(cachedServiceProvider2); |
||||
|
|
||||
|
var transientTestService2_1 = cachedServiceProvider2.GetRequiredService<TransientTestService>(); |
||||
|
var transientTestService2_2 = cachedServiceProvider2.GetRequiredService<TransientTestService>(); |
||||
|
transientTestService2_1.ShouldBeSameAs(transientTestService2_2); |
||||
|
|
||||
|
transientTestService1_1.ShouldNotBeSameAs(transientTestService2_1); |
||||
|
} |
||||
|
|
||||
|
using (var application = AbpApplicationFactory.Create<TestModule>()) |
||||
|
{ |
||||
|
application.Initialize(); |
||||
|
|
||||
|
using (var scope1 = application.ServiceProvider.CreateScope()) |
||||
|
{ |
||||
|
TestResolvingServices(scope1); |
||||
|
var testCounter = scope1.ServiceProvider.GetRequiredService<ITestCounter>(); |
||||
|
testCounter.GetValue(nameof(TransientTestService)).ShouldBe(2); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
[DependsOn(typeof(AbpTestBaseModule))] |
||||
|
private class TestModule : AbpModule |
||||
|
{ |
||||
|
public TestModule() |
||||
|
{ |
||||
|
SkipAutoServiceRegistration = true; |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddType<TransientTestService>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private class TransientTestService : ITransientDependency |
||||
|
{ |
||||
|
public TransientTestService(ITestCounter counter) |
||||
|
{ |
||||
|
counter.Increment(nameof(TransientTestService)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,26 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations |
||||
|
{ |
||||
|
public partial class Add_IsActive_To_BlogUser : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AddColumn<bool>( |
||||
|
name: "IsActive", |
||||
|
table: "BlgUsers", |
||||
|
type: "bit", |
||||
|
nullable: false, |
||||
|
defaultValue: false); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "IsActive", |
||||
|
table: "BlgUsers"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,456 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
namespace Volo.CmsKit.Migrations; |
|
||||
|
|
||||
public partial class Initial : Migration |
|
||||
{ |
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "AbpBlobContainers", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsBlogFeatures", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
FeatureName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
IsEnabled = table.Column<bool>(type: "bit", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsBlogFeatures", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsBlogs", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
Slug = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsBlogs", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsComments", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
Text = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false), |
|
||||
RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsComments", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsEntityTags", |
|
||||
columns: table => new { |
|
||||
TagId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
EntityId = table.Column<string>(type: "nvarchar(450)", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId }); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsMediaDescriptors", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
Name = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false), |
|
||||
MimeType = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
|
||||
Size = table.Column<long>(type: "bigint", maxLength: 2147483647, nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsMediaDescriptors", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsMenus", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsMenus", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsPages", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|
||||
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|
||||
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true), |
|
||||
Script = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
Style = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsPages", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsRatings", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
StarCount = table.Column<short>(type: "smallint", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsRatings", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsTags", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsTags", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsUserReactions", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
ReactionName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsUserReactions", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsUsers", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|
||||
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|
||||
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
|
||||
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
|
||||
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true), |
|
||||
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsUsers", x => x.Id); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "AbpBlobs", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|
||||
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_AbpBlobs", x => x.Id); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId", |
|
||||
column: x => x.ContainerId, |
|
||||
principalTable: "AbpBlobContainers", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsMenuItems", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: false), |
|
||||
Url = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false), |
|
||||
Icon = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
Order = table.Column<int>(type: "int", nullable: false), |
|
||||
Target = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ElementId = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
CssClass = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
RequiredPermissionName = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
PageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsMenuItems", x => x.Id); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_CmsMenuItems_CmsMenus_MenuId", |
|
||||
column: x => x.MenuId, |
|
||||
principalTable: "CmsMenus", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "CmsBlogPosts", |
|
||||
columns: table => new { |
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
Title = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
|
||||
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|
||||
ShortDescription = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), |
|
||||
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true), |
|
||||
CoverImageMediaId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
AuthorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_CmsBlogPosts", x => x.Id); |
|
||||
table.ForeignKey( |
|
||||
name: "FK_CmsBlogPosts_CmsUsers_AuthorId", |
|
||||
column: x => x.AuthorId, |
|
||||
principalTable: "CmsUsers", |
|
||||
principalColumn: "Id", |
|
||||
onDelete: ReferentialAction.Cascade); |
|
||||
}); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_AbpBlobContainers_TenantId_Name", |
|
||||
table: "AbpBlobContainers", |
|
||||
columns: new[] { "TenantId", "Name" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_AbpBlobs_ContainerId", |
|
||||
table: "AbpBlobs", |
|
||||
column: "ContainerId"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_AbpBlobs_TenantId_ContainerId_Name", |
|
||||
table: "AbpBlobs", |
|
||||
columns: new[] { "TenantId", "ContainerId", "Name" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsBlogPosts_AuthorId", |
|
||||
table: "CmsBlogPosts", |
|
||||
column: "AuthorId"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsBlogPosts_Slug_BlogId", |
|
||||
table: "CmsBlogPosts", |
|
||||
columns: new[] { "Slug", "BlogId" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsComments_TenantId_EntityType_EntityId", |
|
||||
table: "CmsComments", |
|
||||
columns: new[] { "TenantId", "EntityType", "EntityId" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsComments_TenantId_RepliedCommentId", |
|
||||
table: "CmsComments", |
|
||||
columns: new[] { "TenantId", "RepliedCommentId" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsEntityTags_TenantId_EntityId_TagId", |
|
||||
table: "CmsEntityTags", |
|
||||
columns: new[] { "TenantId", "EntityId", "TagId" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsMenuItems_MenuId", |
|
||||
table: "CmsMenuItems", |
|
||||
column: "MenuId"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsPages_TenantId_Slug", |
|
||||
table: "CmsPages", |
|
||||
columns: new[] { "TenantId", "Slug" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId", |
|
||||
table: "CmsRatings", |
|
||||
columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsTags_TenantId_Name", |
|
||||
table: "CmsTags", |
|
||||
columns: new[] { "TenantId", "Name" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName", |
|
||||
table: "CmsUserReactions", |
|
||||
columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName", |
|
||||
table: "CmsUserReactions", |
|
||||
columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsUsers_TenantId_Email", |
|
||||
table: "CmsUsers", |
|
||||
columns: new[] { "TenantId", "Email" }); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_CmsUsers_TenantId_UserName", |
|
||||
table: "CmsUsers", |
|
||||
columns: new[] { "TenantId", "UserName" }); |
|
||||
} |
|
||||
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropTable( |
|
||||
name: "AbpBlobs"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsBlogFeatures"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsBlogPosts"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsBlogs"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsComments"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsEntityTags"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsMediaDescriptors"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsMenuItems"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsPages"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsRatings"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsTags"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsUserReactions"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "AbpBlobContainers"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsUsers"); |
|
||||
|
|
||||
migrationBuilder.DropTable( |
|
||||
name: "CmsMenus"); |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,466 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace Volo.CmsKit.Migrations |
||||
|
{ |
||||
|
public partial class Initial : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpBlobContainers", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsBlogFeatures", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
FeatureName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
IsEnabled = table.Column<bool>(type: "bit", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsBlogFeatures", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsBlogs", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Slug = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsBlogs", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsComments", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Text = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false), |
||||
|
RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsComments", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsEntityTags", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
TagId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
EntityId = table.Column<string>(type: "nvarchar(450)", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId }); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsGlobalResources", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
||||
|
Value = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsGlobalResources", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsMediaDescriptors", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false), |
||||
|
MimeType = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
||||
|
Size = table.Column<long>(type: "bigint", maxLength: 2147483647, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsMediaDescriptors", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsMenuItems", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
IsActive = table.Column<bool>(type: "bit", nullable: false), |
||||
|
Url = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false), |
||||
|
Icon = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
Order = table.Column<int>(type: "int", nullable: false), |
||||
|
Target = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ElementId = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
CssClass = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
PageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsMenuItems", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsPages", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
||||
|
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
||||
|
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true), |
||||
|
Script = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
Style = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsPages", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsRatings", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
StarCount = table.Column<short>(type: "smallint", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsRatings", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsTags", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsTags", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsUserReactions", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
EntityType = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
EntityId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
ReactionName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsUserReactions", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsUsers", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
||||
|
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
||||
|
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
||||
|
IsActive = table.Column<bool>(type: "bit", nullable: false), |
||||
|
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true), |
||||
|
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsUsers", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpBlobs", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
||||
|
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpBlobs", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId", |
||||
|
column: x => x.ContainerId, |
||||
|
principalTable: "AbpBlobContainers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsBlogPosts", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
BlogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Title = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
||||
|
ShortDescription = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), |
||||
|
Content = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: true), |
||||
|
CoverImageMediaId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
AuthorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Status = table.Column<int>(type: "int", nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
||||
|
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsBlogPosts", x => x.Id); |
||||
|
table.ForeignKey( |
||||
|
name: "FK_CmsBlogPosts_CmsUsers_AuthorId", |
||||
|
column: x => x.AuthorId, |
||||
|
principalTable: "CmsUsers", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpBlobContainers_TenantId_Name", |
||||
|
table: "AbpBlobContainers", |
||||
|
columns: new[] { "TenantId", "Name" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpBlobs_ContainerId", |
||||
|
table: "AbpBlobs", |
||||
|
column: "ContainerId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpBlobs_TenantId_ContainerId_Name", |
||||
|
table: "AbpBlobs", |
||||
|
columns: new[] { "TenantId", "ContainerId", "Name" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsBlogPosts_AuthorId", |
||||
|
table: "CmsBlogPosts", |
||||
|
column: "AuthorId"); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsBlogPosts_Slug_BlogId", |
||||
|
table: "CmsBlogPosts", |
||||
|
columns: new[] { "Slug", "BlogId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsComments_TenantId_EntityType_EntityId", |
||||
|
table: "CmsComments", |
||||
|
columns: new[] { "TenantId", "EntityType", "EntityId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsComments_TenantId_RepliedCommentId", |
||||
|
table: "CmsComments", |
||||
|
columns: new[] { "TenantId", "RepliedCommentId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsEntityTags_TenantId_EntityId_TagId", |
||||
|
table: "CmsEntityTags", |
||||
|
columns: new[] { "TenantId", "EntityId", "TagId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsPages_TenantId_Slug", |
||||
|
table: "CmsPages", |
||||
|
columns: new[] { "TenantId", "Slug" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId", |
||||
|
table: "CmsRatings", |
||||
|
columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsTags_TenantId_Name", |
||||
|
table: "CmsTags", |
||||
|
columns: new[] { "TenantId", "Name" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName", |
||||
|
table: "CmsUserReactions", |
||||
|
columns: new[] { "TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsUserReactions_TenantId_EntityType_EntityId_ReactionName", |
||||
|
table: "CmsUserReactions", |
||||
|
columns: new[] { "TenantId", "EntityType", "EntityId", "ReactionName" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsUsers_TenantId_Email", |
||||
|
table: "CmsUsers", |
||||
|
columns: new[] { "TenantId", "Email" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_CmsUsers_TenantId_UserName", |
||||
|
table: "CmsUsers", |
||||
|
columns: new[] { "TenantId", "UserName" }); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpBlobs"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsBlogFeatures"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsBlogPosts"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsBlogs"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsComments"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsEntityTags"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsGlobalResources"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsMediaDescriptors"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsMenuItems"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsPages"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsRatings"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsTags"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsUserReactions"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpBlobContainers"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsUsers"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,26 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace Volo.CmsKit.Migrations |
|
||||
{ |
|
||||
public partial class Added_BlogPostStatus : Migration |
|
||||
{ |
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.AddColumn<int>( |
|
||||
name: "Status", |
|
||||
table: "CmsBlogPosts", |
|
||||
type: "int", |
|
||||
nullable: false, |
|
||||
defaultValue: 0); |
|
||||
} |
|
||||
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "Status", |
|
||||
table: "CmsBlogPosts"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue