2020-11-17 10:00:01 +00:00
|
|
|
|
using System;
|
2019-12-10 13:42:29 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
2020-11-17 10:00:01 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
2019-12-10 13:42:29 +00:00
|
|
|
|
namespace ASC.Core.Common.EF.Model
|
|
|
|
|
{
|
|
|
|
|
[Table("notify_info")]
|
|
|
|
|
public class NotifyInfo
|
|
|
|
|
{
|
|
|
|
|
[Key]
|
|
|
|
|
[Column("notify_id")]
|
|
|
|
|
public int NotifyId { get; set; }
|
|
|
|
|
public int State { get; set; }
|
|
|
|
|
public int Attempts { get; set; }
|
|
|
|
|
|
|
|
|
|
[Column("modify_date")]
|
|
|
|
|
public DateTime ModifyDate { get; set; }
|
|
|
|
|
public int Priority { get; set; }
|
|
|
|
|
}
|
2020-08-21 02:34:37 +00:00
|
|
|
|
public static class NotifyInfoExtension
|
|
|
|
|
{
|
2020-09-06 22:49:03 +00:00
|
|
|
|
public static ModelBuilderWrapper AddNotifyInfo(this ModelBuilderWrapper modelBuilder)
|
|
|
|
|
{
|
2020-10-12 19:39:23 +00:00
|
|
|
|
modelBuilder
|
2020-09-06 22:49:03 +00:00
|
|
|
|
.Add(MySqlAddNotifyInfo, Provider.MySql)
|
2020-10-08 09:07:05 +00:00
|
|
|
|
.Add(PgSqlAddNotifyInfo, Provider.Postgre);
|
2020-09-06 22:49:03 +00:00
|
|
|
|
return modelBuilder;
|
|
|
|
|
}
|
|
|
|
|
public static void MySqlAddNotifyInfo(this ModelBuilder modelBuilder)
|
2020-08-21 02:34:37 +00:00
|
|
|
|
{
|
2020-10-12 19:39:23 +00:00
|
|
|
|
modelBuilder.Entity<NotifyInfo>(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_info");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.HasIndex(e => e.State)
|
2020-11-17 10:47:17 +00:00
|
|
|
|
.HasDatabaseName("state");
|
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.Attempts).HasColumnName("attempts");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.ModifyDate)
|
2020-08-21 02:34:37 +00:00
|
|
|
|
.HasColumnName("modify_date")
|
|
|
|
|
.HasColumnType("datetime");
|
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.Priority).HasColumnName("priority");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.State).HasColumnName("state");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
2020-09-06 22:49:03 +00:00
|
|
|
|
public static void PgSqlAddNotifyInfo(this ModelBuilder modelBuilder)
|
2020-08-21 02:34:37 +00:00
|
|
|
|
{
|
2020-10-12 19:39:23 +00:00
|
|
|
|
modelBuilder.Entity<NotifyInfo>(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_info_pkey");
|
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.ToTable("notify_info", "onlyoffice");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.HasIndex(e => e.State)
|
2020-11-17 10:47:17 +00:00
|
|
|
|
.HasDatabaseName("state");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.NotifyId)
|
2020-08-21 02:34:37 +00:00
|
|
|
|
.HasColumnName("notify_id")
|
|
|
|
|
.ValueGeneratedNever();
|
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.Attempts).HasColumnName("attempts");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.ModifyDate).HasColumnName("modify_date");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.Priority).HasColumnName("priority");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2020-10-12 19:39:23 +00:00
|
|
|
|
entity.Property(e => e.State).HasColumnName("state");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-10 13:42:29 +00:00
|
|
|
|
}
|