DocSpace-client/common/ASC.Core.Common/EF/Model/DbWebstudioUservisit.cs

103 lines
3.7 KiB
C#
Raw Normal View History

2019-12-06 16:01:12 +00:00
using System;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Model
{
2019-12-10 15:31:37 +00:00
[Table("webstudio_uservisit")]
2019-12-06 16:01:12 +00:00
public class DbWebstudioUserVisit
{
public int TenantId { get; set; }
public DateTime VisitDate { get; set; }
public Guid ProductId { get; set; }
public Guid UserId { get; set; }
public int VisitCount { get; set; }
public DateTime FirstVisitTime { get; set; }
public DateTime LastVisitTime { get; set; }
}
public static class WebstudioUserVisitExtension
{
2020-09-06 22:49:03 +00:00
public static ModelBuilderWrapper AddWebstudioUserVisit(this ModelBuilderWrapper modelBuilder)
{
modelBuilder
.Add(MySqlAddWebstudioUserVisit, Provider.MySql)
.Add(PgSqlAddWebstudioUserVisit, Provider.Postrge);
return modelBuilder;
}
public static void MySqlAddWebstudioUserVisit(this ModelBuilder modelBuilder)
2019-12-06 16:01:12 +00:00
{
2020-08-21 02:34:37 +00:00
modelBuilder.Entity<DbWebstudioUserVisit>(entity =>
{
entity.HasKey(e => new { e.TenantId, e.VisitDate, e.ProductId, e.UserId })
.HasName("PRIMARY");
2019-12-06 16:01:12 +00:00
2020-08-21 02:34:37 +00:00
entity.ToTable("webstudio_uservisit");
entity.HasIndex(e => e.VisitDate)
.HasName("visitdate");
entity.Property(e => e.TenantId).HasColumnName("tenantid");
entity.Property(e => e.VisitDate)
.HasColumnName("visitdate")
.HasColumnType("datetime");
entity.Property(e => e.ProductId)
.HasColumnName("productid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.UserId)
.HasColumnName("userid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
entity.Property(e => e.FirstVisitTime)
.HasColumnName("firstvisittime")
.HasColumnType("datetime");
entity.Property(e => e.LastVisitTime)
.HasColumnName("lastvisittime")
.HasColumnType("datetime");
entity.Property(e => e.VisitCount).HasColumnName("visitcount");
});
}
2020-09-06 22:49:03 +00:00
public static void PgSqlAddWebstudioUserVisit(this ModelBuilder modelBuilder)
2020-08-21 02:34:37 +00:00
{
modelBuilder.Entity<DbWebstudioUserVisit>(entity =>
{
entity.HasKey(e => new { e.TenantId, e.VisitDate, e.ProductId, e.UserId })
.HasName("webstudio_uservisit_pkey");
entity.ToTable("webstudio_uservisit", "onlyoffice");
entity.HasIndex(e => e.VisitDate)
.HasName("visitdate");
entity.Property(e => e.TenantId).HasColumnName("tenantid");
entity.Property(e => e.VisitDate).HasColumnName("visitdate");
entity.Property(e => e.ProductId)
.HasColumnName("productid")
.HasMaxLength(38);
entity.Property(e => e.UserId)
.HasColumnName("userid")
.HasMaxLength(38);
entity.Property(e => e.FirstVisitTime).HasColumnName("firstvisittime");
entity.Property(e => e.LastVisitTime).HasColumnName("lastvisittime");
entity.Property(e => e.VisitCount).HasColumnName("visitcount");
});
2019-12-06 16:01:12 +00:00
}
}
}