DocSpace-client/common/ASC.Core.Common/EF/Model/Feed/FeedAggregate.cs
pavelbannov e01ee037f2 Merge branch 'master' into feature/fix-messages
# Conflicts:
#	common/ASC.Core.Common/Billing/TariffService.cs
#	common/ASC.Core.Common/EF/Context/BaseDbContext.cs
#	common/ASC.Core.Common/EF/Context/CoreDbContext.cs
#	common/ASC.Core.Common/EF/Context/DbContext.cs
#	common/ASC.Core.Common/EF/Context/DbContextManager.cs
#	common/ASC.Core.Common/EF/Context/FeedDbContext.cs
#	common/ASC.Core.Common/EF/Context/FilesDbContext.cs
#	common/ASC.Core.Common/EF/Context/MessagesContext.cs
#	common/ASC.Core.Common/EF/Context/ResourceDbContext.cs
#	common/ASC.Core.Common/EF/Context/TelegramDbContext.cs
#	common/ASC.Core.Common/EF/Context/WebstudioDbContext.cs
#	common/ASC.Core.Common/EF/Model/AccountLinks.cs
#	common/ASC.Core.Common/EF/Model/Core/Acl.cs
#	common/ASC.Core.Common/EF/Model/Core/DbCoreSettings.cs
#	common/ASC.Core.Common/EF/Model/Core/DbSubscriptionMethod.cs
#	common/ASC.Core.Common/EF/Model/Core/Subscription.cs
#	common/ASC.Core.Common/EF/Model/DbWebstudioSettings.cs
#	common/ASC.Core.Common/EF/Model/DbWebstudioUservisit.cs
#	common/ASC.Core.Common/EF/Model/Feed/FeedReaded.cs
#	common/ASC.Core.Common/EF/Model/Feed/FeedUsers.cs
#	common/ASC.Core.Common/EF/Model/FilesConverts.cs
#	common/ASC.Core.Common/EF/Model/MobileAppInstall.cs
#	common/ASC.Core.Common/EF/Model/Resource/ResAuthorsFile.cs
#	common/ASC.Core.Common/EF/Model/Resource/ResAuthorsLang.cs
#	common/ASC.Core.Common/EF/Model/TelegramUser.cs
#	common/ASC.Core.Common/EF/Model/Tenant/DbButton.cs
#	common/ASC.Core.Common/EF/Model/Tenant/DbQuotaRow.cs
#	common/ASC.Core.Common/EF/Model/User/UserGroup.cs
#	common/ASC.Core.Common/HostedSolution.cs
#	common/ASC.Core.Common/Security/EmailValidationKeyProvider.cs
#	common/ASC.Data.Reassigns/QueueWorker.cs
#	common/ASC.Data.Reassigns/ReassignProgressItem.cs
#	common/ASC.Data.Reassigns/RemoveProgressItem.cs
#	common/ASC.VoipService/Dao/CachedVoipDao.cs
#	products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs
#	products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs
#	products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs
#	products/ASC.Files/Core/Core/EF/DbEncryptedData.cs
#	products/ASC.Files/Core/Core/EF/DbFile.cs
#	products/ASC.Files/Core/Core/EF/DbFilesBunchObjects.cs
#	products/ASC.Files/Core/Core/EF/DbFilesSecurity.cs
#	products/ASC.Files/Core/Core/EF/DbFilesTagLink.cs
#	products/ASC.Files/Core/Core/EF/DbFilesThirdpartyApp.cs
#	products/ASC.Files/Core/Core/EF/DbFilesThirdpartyIdMapping.cs
#	products/ASC.Files/Core/Core/EF/DbFolderTree.cs
#	products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs
#	products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs
#	products/ASC.Files/Core/Core/Thirdparty/CachedProviderAccountDao.cs
#	products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderSecutiryDao.cs
#	products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderTagDao.cs
#	products/ASC.Files/Core/Utils/EntryManager.cs
#	products/ASC.Files/Server/Startup.cs
#	web/ASC.Web.Studio/Startup.cs
2020-10-09 15:40:44 +03:00

193 lines
6.8 KiB
C#

using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace ASC.Core.Common.EF.Model
{
[Table("feed_aggregate")]
public class FeedAggregate : BaseEntity
{
public string Id { get; set; }
public int Tenant { get; set; }
public string Product { get; set; }
public string Module { get; set; }
public Guid Author { get; set; }
[Column("modified_by")]
public Guid ModifiedBy { get; set; }
[Column("created_date")]
public DateTime CreatedDate { get; set; }
[Column("modified_date")]
public DateTime ModifiedDate { get; set; }
[Column("group_id")]
public string GroupId { get; set; }
[Column("aggregated_date")]
public DateTime AggregateDate { get; set; }
public string Json { get; set; }
public string Keywords { get; set; }
public override object[] GetKeys()
{
return new object[] { Id };
}
}
public static class FeedAggregateExtension
{
public static ModelBuilderWrapper AddFeedAggregate(this ModelBuilderWrapper modelBuilder)
{
modelBuilder
.Add(MySqlAddFeedAggregate, Provider.MySql)
.Add(PgSqlAddFeedAggregate, Provider.Postgre);
return modelBuilder;
}
public static void MySqlAddFeedAggregate(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<FeedAggregate>(entity =>
{
entity.ToTable("feed_aggregate");
entity.HasIndex(e => new { e.Tenant, e.AggregateDate })
.HasName("aggregated_date");
entity.HasIndex(e => new { e.Tenant, e.ModifiedDate })
.HasName("modified_date");
entity.HasIndex(e => new { e.Tenant, e.Product })
.HasName("product");
entity.Property(e => e.Id)
.HasColumnName("id")
.HasColumnType("varchar(88)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.AggregateDate)
.HasColumnName("aggregated_date")
.HasColumnType("datetime");
entity.Property(e => e.Author)
.IsRequired()
.HasColumnName("author")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.CreatedDate)
.HasColumnName("created_date")
.HasColumnType("datetime");
entity.Property(e => e.GroupId)
.HasColumnName("group_id")
.HasColumnType("varchar(70)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.Json)
.IsRequired()
.HasColumnName("json")
.HasColumnType("mediumtext")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.Keywords)
.HasColumnName("keywords")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.ModifiedBy)
.IsRequired()
.HasColumnName("modified_by")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.ModifiedDate)
.HasColumnName("modified_date")
.HasColumnType("datetime");
entity.Property(e => e.Module)
.IsRequired()
.HasColumnName("module")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.Product)
.IsRequired()
.HasColumnName("product")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
});
}
public static void PgSqlAddFeedAggregate(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<FeedAggregate>(entity =>
{
entity.ToTable("feed_aggregate", "onlyoffice");
entity.HasIndex(e => new { e.Tenant, e.AggregateDate })
.HasName("aggregated_date");
entity.HasIndex(e => new { e.Tenant, e.ModifiedDate })
.HasName("modified_date");
entity.HasIndex(e => new { e.Tenant, e.Product })
.HasName("product");
entity.Property(e => e.Id)
.HasColumnName("id")
.HasMaxLength(88);
entity.Property(e => e.AggregateDate).HasColumnName("aggregated_date");
entity.Property(e => e.Author)
.IsRequired()
.HasColumnName("author")
.HasMaxLength(38)
.IsFixedLength();
entity.Property(e => e.CreatedDate).HasColumnName("created_date");
entity.Property(e => e.GroupId)
.HasColumnName("group_id")
.HasMaxLength(70)
.HasDefaultValueSql("NULL");
entity.Property(e => e.Json)
.IsRequired()
.HasColumnName("json");
entity.Property(e => e.Keywords).HasColumnName("keywords");
entity.Property(e => e.ModifiedBy)
.IsRequired()
.HasColumnName("modified_by")
.HasMaxLength(38)
.IsFixedLength();
entity.Property(e => e.ModifiedDate).HasColumnName("modified_date");
entity.Property(e => e.Module)
.IsRequired()
.HasColumnName("module")
.HasMaxLength(50);
entity.Property(e => e.Product)
.IsRequired()
.HasColumnName("product")
.HasMaxLength(50);
entity.Property(e => e.Tenant).HasColumnName("tenant");
});
}
}
}