2022-02-15 11:52:43 +00:00
|
|
|
|
namespace ASC.Core.Common.EF.Model;
|
|
|
|
|
|
|
|
|
|
public class TenantIpRestrictions
|
2019-12-10 14:47:48 +00:00
|
|
|
|
{
|
2022-02-15 11:52:43 +00:00
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public int Tenant { get; set; }
|
|
|
|
|
public string Ip { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class TenantIpRestrictionsExtension
|
|
|
|
|
{
|
|
|
|
|
public static ModelBuilderWrapper AddTenantIpRestrictions(this ModelBuilderWrapper modelBuilder)
|
2019-12-10 14:47:48 +00:00
|
|
|
|
{
|
2022-02-15 11:52:43 +00:00
|
|
|
|
modelBuilder
|
|
|
|
|
.Add(MySqlAddTenantIpRestrictions, Provider.MySql)
|
|
|
|
|
.Add(PgSqlAddTenantIpRestrictions, Provider.PostgreSql);
|
|
|
|
|
|
|
|
|
|
return modelBuilder;
|
2019-12-10 14:47:48 +00:00
|
|
|
|
}
|
2022-02-14 21:02:57 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
public static void MySqlAddTenantIpRestrictions(this ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder.Entity<TenantIpRestrictions>(entity =>
|
2020-08-21 02:34:37 +00:00
|
|
|
|
{
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.ToTable("tenants_iprestrictions");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.HasIndex(e => e.Tenant)
|
|
|
|
|
.HasDatabaseName("tenant");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.Property(e => e.Id).HasColumnName("id");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.Property(e => e.Ip)
|
|
|
|
|
.IsRequired()
|
|
|
|
|
.HasColumnName("ip")
|
|
|
|
|
.HasColumnType("varchar(50)")
|
|
|
|
|
.HasCharSet("utf8")
|
|
|
|
|
.UseCollation("utf8_general_ci");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.Property(e => e.Tenant).HasColumnName("tenant");
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
public static void PgSqlAddTenantIpRestrictions(this ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder.Entity<TenantIpRestrictions>(entity =>
|
2020-08-21 02:34:37 +00:00
|
|
|
|
{
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.ToTable("tenants_iprestrictions", "onlyoffice");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.HasIndex(e => e.Tenant)
|
|
|
|
|
.HasDatabaseName("tenant_tenants_iprestrictions");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.Property(e => e.Id).HasColumnName("id");
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.Property(e => e.Ip)
|
|
|
|
|
.IsRequired()
|
|
|
|
|
.HasColumnName("ip")
|
|
|
|
|
.HasMaxLength(50);
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
|
entity.Property(e => e.Tenant).HasColumnName("tenant");
|
|
|
|
|
});
|
2020-08-21 02:34:37 +00:00
|
|
|
|
|
|
|
|
|
}
|
2019-12-10 14:47:48 +00:00
|
|
|
|
}
|