DocSpace-buildtools/common/ASC.Core.Common/EF/Model/Tenant/DbTenantVersion.cs

78 lines
2.3 KiB
C#
Raw Normal View History

2022-02-15 11:52:43 +00:00
namespace ASC.Core.Common.EF.Model;
public class DbTenantVersion
2019-12-03 15:20:21 +00:00
{
2022-02-15 11:52:43 +00:00
public int Id { get; set; }
public string Version { get; set; }
public string Url { get; set; }
public int DefaultVersion { get; set; }
public bool Visible { get; set; }
}
public static class DbTenantVersionExtension
{
public static ModelBuilderWrapper AddDbTenantVersion(this ModelBuilderWrapper modelBuilder)
2019-12-03 15:20:21 +00:00
{
2022-02-15 11:52:43 +00:00
modelBuilder
.Add(MySqlAddDbTenantVersion, Provider.MySql)
.Add(PgSqlAddDbTenantVersion, Provider.PostgreSql);
return modelBuilder;
2019-12-03 15:20:21 +00:00
}
2022-02-15 11:52:43 +00:00
public static void MySqlAddDbTenantVersion(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<DbTenantVersion>(entity =>
2020-08-21 02:34:37 +00:00
{
2022-02-15 11:52:43 +00:00
entity.ToTable("tenants_version");
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.DefaultVersion).HasColumnName("default_version");
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
entity.Property(e => e.Url)
.IsRequired()
.HasColumnName("url")
.HasColumnType("varchar(64)")
.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.Version)
.IsRequired()
.HasColumnName("version")
.HasColumnType("varchar(64)")
.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.Visible).HasColumnName("visible");
});
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
}
public static void PgSqlAddDbTenantVersion(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<DbTenantVersion>(entity =>
2020-08-21 02:34:37 +00:00
{
2022-02-15 11:52:43 +00:00
entity.ToTable("tenants_version", "onlyoffice");
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
entity.Property(e => e.Id)
.HasColumnName("id")
.ValueGeneratedNever();
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
entity.Property(e => e.DefaultVersion).HasColumnName("default_version");
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
entity.Property(e => e.Url)
.IsRequired()
.HasColumnName("url")
.HasMaxLength(64);
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
entity.Property(e => e.Version)
.IsRequired()
.HasColumnName("version")
.HasMaxLength(64);
2020-08-21 02:34:37 +00:00
2022-02-15 11:52:43 +00:00
entity.Property(e => e.Visible).HasColumnName("visible");
});
2020-08-21 02:34:37 +00:00
}
2019-12-03 15:20:21 +00:00
}