DocSpace-buildtools/common/ASC.Core.Common/EF/Model/Notify/NotifyQueue.cs

161 lines
6.0 KiB
C#
Raw Normal View History

2020-08-21 02:34:37 +00:00
using Microsoft.EntityFrameworkCore;
using System;
2019-12-10 13:42:29 +00:00
using System.ComponentModel.DataAnnotations;
namespace ASC.Core.Common.EF.Model
{
public class NotifyQueue
{
[Key]
public int NotifyId { get; set; }
public int TenantId { get; set; }
public string Sender { get; set; }
public string Reciever { get; set; }
public string Subject { get; set; }
public string ContentType { get; set; }
public string Content { get; set; }
public string SenderType { get; set; }
public string ReplyTo { get; set; }
public DateTime CreationDate { get; set; }
public string Attachments { get; set; }
2020-09-18 07:59:23 +00:00
public string AutoSubmitted { get; set; }
2019-12-10 13:42:29 +00:00
}
2020-08-21 02:34:37 +00:00
public static class NotifyQueueExtension
{
2020-09-06 22:49:03 +00:00
public static ModelBuilderWrapper AddNotifyQueue(this ModelBuilderWrapper modelBuilder)
{
2020-10-12 19:39:23 +00:00
modelBuilder
2020-09-06 22:49:03 +00:00
.Add(MySqlAddNotifyQueue, Provider.MySql)
2020-10-08 09:07:05 +00:00
.Add(PgSqlAddNotifyQueue, Provider.Postgre);
2020-09-06 22:49:03 +00:00
return modelBuilder;
}
public static void MySqlAddNotifyQueue(this ModelBuilder modelBuilder)
2020-08-21 02:34:37 +00:00
{
2020-10-12 19:39:23 +00:00
modelBuilder.Entity<NotifyQueue>(entity =>
2020-08-21 02:34:37 +00:00
{
2020-10-12 19:39:23 +00:00
entity.HasKey(e => e.NotifyId)
2020-08-21 02:34:37 +00:00
.HasName("PRIMARY");
2020-10-12 19:39:23 +00:00
entity.ToTable("notify_queue");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.NotifyId).HasColumnName("notify_id");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Attachments)
2020-08-21 02:34:37 +00:00
.HasColumnName("attachments")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.AutoSubmitted)
.HasColumnName("auto_submitted")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Content)
2020-08-21 02:34:37 +00:00
.HasColumnName("content")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.ContentType)
2020-08-21 02:34:37 +00:00
.HasColumnName("content_type")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.CreationDate)
2020-08-21 02:34:37 +00:00
.HasColumnName("creation_date")
.HasColumnType("datetime");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Reciever)
2020-08-21 02:34:37 +00:00
.HasColumnName("reciever")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.ReplyTo)
2020-08-21 02:34:37 +00:00
.HasColumnName("reply_to")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Sender)
2020-08-21 02:34:37 +00:00
.HasColumnName("sender")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.SenderType)
2020-08-21 02:34:37 +00:00
.HasColumnName("sender_type")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Subject)
2020-08-21 02:34:37 +00:00
.HasColumnName("subject")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
2020-08-21 02:34:37 +00:00
});
}
2020-09-06 22:49:03 +00:00
public static void PgSqlAddNotifyQueue(this ModelBuilder modelBuilder)
2020-08-21 02:34:37 +00:00
{
2020-10-12 19:39:23 +00:00
modelBuilder.Entity<NotifyQueue>(entity =>
2020-08-21 02:34:37 +00:00
{
2020-10-12 19:39:23 +00:00
entity.HasKey(e => e.NotifyId)
2020-08-21 02:34:37 +00:00
.HasName("notify_queue_pkey");
2020-10-12 19:39:23 +00:00
entity.ToTable("notify_queue", "onlyoffice");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.NotifyId).HasColumnName("notify_id");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Attachments).HasColumnName("attachments");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.AutoSubmitted)
.HasColumnName("auto_submitted")
.HasMaxLength(64)
.HasDefaultValueSql("NULL");
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Content).HasColumnName("content");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.ContentType)
2020-08-21 02:34:37 +00:00
.HasColumnName("content_type")
.HasMaxLength(64)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("NULL");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.CreationDate).HasColumnName("creation_date");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Reciever)
2020-08-21 02:34:37 +00:00
.HasColumnName("reciever")
.HasMaxLength(255)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("NULL");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.ReplyTo)
2020-08-21 02:34:37 +00:00
.HasColumnName("reply_to")
.HasMaxLength(1024)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("NULL");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Sender)
2020-08-21 02:34:37 +00:00
.HasColumnName("sender")
.HasMaxLength(255)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("NULL");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.SenderType)
2020-08-21 02:34:37 +00:00
.HasColumnName("sender_type")
.HasMaxLength(64)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("NULL");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.Subject)
2020-08-21 02:34:37 +00:00
.HasColumnName("subject")
.HasMaxLength(1024)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("NULL");
2020-08-21 02:34:37 +00:00
2020-10-12 19:39:23 +00:00
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
2020-08-21 02:34:37 +00:00
});
}
}
2019-12-10 13:42:29 +00:00
}