2019-12-04 11:40:42 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2019-12-17 13:01:59 +00:00
|
|
|
|
|
2019-12-04 11:40:42 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace ASC.Core.Common.EF.Model
|
|
|
|
|
{
|
|
|
|
|
[Table("account_links")]
|
2019-12-17 13:01:59 +00:00
|
|
|
|
public class AccountLinks : BaseEntity
|
2019-12-04 11:40:42 +00:00
|
|
|
|
{
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
public string UId { get; set; }
|
|
|
|
|
public string Provider { get; set; }
|
|
|
|
|
public string Profile { get; set; }
|
|
|
|
|
public DateTime Linked { get; set; }
|
2019-12-17 13:01:59 +00:00
|
|
|
|
|
2020-02-21 12:38:04 +00:00
|
|
|
|
public override object[] GetKeys()
|
2019-12-17 13:01:59 +00:00
|
|
|
|
{
|
|
|
|
|
return new object[] { Id, UId };
|
|
|
|
|
}
|
2019-12-04 11:40:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class AccountLinksExtension
|
|
|
|
|
{
|
2020-09-06 22:49:03 +00:00
|
|
|
|
public static ModelBuilderWrapper AddAccountLinks(this ModelBuilderWrapper modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder
|
|
|
|
|
.Add(MySqlAddAccountLinks, Provider.MySql)
|
2020-10-08 09:07:05 +00:00
|
|
|
|
.Add(PgSqlAddAccountLinks, Provider.Postgre);
|
2020-09-06 22:49:03 +00:00
|
|
|
|
return modelBuilder;
|
|
|
|
|
}
|
|
|
|
|
public static void MySqlAddAccountLinks(this ModelBuilder modelBuilder)
|
2019-12-04 11:40:42 +00:00
|
|
|
|
{
|
2020-08-21 02:34:37 +00:00
|
|
|
|
modelBuilder.Entity<AccountLinks>(entity =>
|
|
|
|
|
{
|
|
|
|
|
entity.HasKey(e => new { e.Id, e.UId })
|
|
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
|
|
|
|
entity.ToTable("account_links");
|
|
|
|
|
|
|
|
|
|
entity.HasIndex(e => e.UId)
|
|
|
|
|
.HasName("uid");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Id)
|
|
|
|
|
.HasColumnName("id")
|
|
|
|
|
.HasColumnType("varchar(200)")
|
|
|
|
|
.HasCharSet("utf8")
|
|
|
|
|
.HasCollation("utf8_general_ci");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.UId)
|
|
|
|
|
.HasColumnName("uid")
|
|
|
|
|
.HasColumnType("varchar(200)")
|
|
|
|
|
.HasCharSet("utf8")
|
|
|
|
|
.HasCollation("utf8_general_ci");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Linked)
|
|
|
|
|
.HasColumnName("linked")
|
|
|
|
|
.HasColumnType("datetime");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Profile)
|
|
|
|
|
.IsRequired()
|
|
|
|
|
.HasColumnName("profile")
|
|
|
|
|
.HasColumnType("text")
|
|
|
|
|
.HasCharSet("utf8")
|
|
|
|
|
.HasCollation("utf8_general_ci");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Provider)
|
|
|
|
|
.HasColumnName("provider")
|
|
|
|
|
.HasColumnType("char(60)")
|
|
|
|
|
.HasCharSet("utf8")
|
|
|
|
|
.HasCollation("utf8_general_ci");
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-09-06 22:49:03 +00:00
|
|
|
|
public static void PgSqlAddAccountLinks(this ModelBuilder modelBuilder)
|
2020-08-21 02:34:37 +00:00
|
|
|
|
{
|
|
|
|
|
modelBuilder.Entity<AccountLinks>(entity =>
|
|
|
|
|
{
|
|
|
|
|
entity.HasKey(e => new { e.Id, e.UId })
|
|
|
|
|
.HasName("account_links_pkey");
|
|
|
|
|
|
|
|
|
|
entity.ToTable("account_links", "onlyoffice");
|
|
|
|
|
|
|
|
|
|
entity.HasIndex(e => e.UId)
|
2020-09-29 17:09:39 +00:00
|
|
|
|
.HasName("uid");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Id)
|
|
|
|
|
.HasColumnName("id")
|
|
|
|
|
.HasMaxLength(200);
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.UId)
|
|
|
|
|
.HasColumnName("uid")
|
|
|
|
|
.HasMaxLength(200);
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Linked).HasColumnName("linked");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Profile)
|
|
|
|
|
.IsRequired()
|
|
|
|
|
.HasColumnName("profile");
|
|
|
|
|
|
|
|
|
|
entity.Property(e => e.Provider)
|
|
|
|
|
.HasColumnName("provider")
|
|
|
|
|
.HasMaxLength(60)
|
2020-09-29 17:09:39 +00:00
|
|
|
|
.IsFixedLength()
|
|
|
|
|
.HasDefaultValueSql("NULL");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
});
|
2019-12-04 11:40:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|