pavelbannov
18a2c0a53d
# Conflicts: # common/ASC.Core.Common/EF/Model/Audit/LoginEvents.cs # common/ASC.Core.Common/EF/Model/CRM/CrmContact.cs # common/ASC.Core.Common/EF/Model/CRM/DbVoipCall.cs # common/ASC.Core.Common/EF/Model/CRM/VoipNumber.cs # common/ASC.Core.Common/EF/Model/DbWebstudioIndex.cs # common/ASC.Core.Common/EF/Model/DbipLocation.cs # common/ASC.Core.Common/EF/Model/Feed/FeedAggregate.cs # common/ASC.Core.Common/EF/Model/Feed/FeedLast.cs # common/ASC.Core.Common/EF/Model/Mail/Mailbox.cs # common/ASC.Core.Common/EF/Model/Mail/ServerServer.cs # common/ASC.Core.Common/EF/Model/Notify/NotifyInfo.cs # common/ASC.Core.Common/EF/Model/Notify/NotifyQueue.cs # common/ASC.Core.Common/EF/Model/Resource/ResAuthors.cs # common/ASC.Core.Common/EF/Model/Resource/ResCultures.cs # common/ASC.Core.Common/EF/Model/Resource/ResData.cs # common/ASC.Core.Common/EF/Model/Resource/ResFiles.cs # common/ASC.Core.Common/EF/Model/Resource/ResReserve.cs # common/ASC.Core.Common/EF/Model/Tenant/DbTariff.cs # common/ASC.Core.Common/EF/Model/Tenant/DbTenantVersion.cs # common/ASC.Core.Common/EF/Model/Tenant/TenantIpRestrictions.cs # common/ASC.Core.Common/EF/Model/User/UserPhoto.cs # common/ASC.Core.Common/Migrations/MySql/CoreDbContextMySql/20201006100008_CoreDbContextMySql.cs # common/ASC.Core.Common/Migrations/MySql/CoreDbContextMySql/20210309093641_CoreDbContextMySql.Designer.cs # common/ASC.Core.Common/Migrations/MySql/CoreDbContextMySql/MySqlCoreDbContextModelSnapshot.cs # common/ASC.Core.Common/Migrations/MySql/TenantDbContextMySql/20201006101436_TenantDbContextMySql.Designer.cs # common/ASC.Core.Common/Migrations/MySql/TenantDbContextMySql/20201006101436_TenantDbContextMySql.cs # common/ASC.Core.Common/Migrations/MySql/TenantDbContextMySql/20210309095116_TenantDbContextMySql.Designer.cs # products/ASC.Files/Core/Core/EF/DbFilesTag.cs # products/ASC.Files/Core/Core/EF/FilesDbContext.cs
182 lines
6.6 KiB
C#
182 lines
6.6 KiB
C#
using System;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ASC.Core.Common.EF.Model
|
|
{
|
|
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; }
|
|
public Guid ModifiedBy { get; set; }
|
|
public DateTime CreatedDate { get; set; }
|
|
public DateTime ModifiedDate { get; set; }
|
|
public string GroupId { get; set; }
|
|
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 })
|
|
.HasDatabaseName("aggregated_date");
|
|
|
|
entity.HasIndex(e => new { e.Tenant, e.ModifiedDate })
|
|
.HasDatabaseName("modified_date");
|
|
|
|
entity.HasIndex(e => new { e.Tenant, e.Product })
|
|
.HasDatabaseName("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 })
|
|
.HasDatabaseName("aggregated_date");
|
|
|
|
entity.HasIndex(e => new { e.Tenant, e.ModifiedDate })
|
|
.HasDatabaseName("modified_date");
|
|
|
|
entity.HasIndex(e => new { e.Tenant, e.Product })
|
|
.HasDatabaseName("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");
|
|
});
|
|
}
|
|
}
|
|
}
|