DocSpace-client/common/ASC.Core.Common/EF/Model/Tenant/DbQuotaRow.cs

102 lines
3.5 KiB
C#
Raw Normal View History

2019-12-02 09:12:16 +00:00
using System;
using System.ComponentModel.DataAnnotations.Schema;
2020-09-06 22:49:03 +00:00
using ASC.Core.Common.EF.Model;
2019-12-17 13:01:59 +00:00
using Microsoft.EntityFrameworkCore;
2019-12-02 09:12:16 +00:00
namespace ASC.Core.Common.EF
{
[Table("tenants_quotarow")]
2019-12-17 13:01:59 +00:00
public class DbQuotaRow : BaseEntity
2019-12-02 09:12:16 +00:00
{
public int Tenant { get; set; }
public string Path { get; set; }
public long Counter { get; set; }
public string Tag { get; set; }
[Column("last_modified")]
public DateTime LastModified { 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[] { Tenant, Path };
}
}
public static class DbQuotaRowExtension
{
2020-09-06 22:49:03 +00:00
public static ModelBuilderWrapper AddDbQuotaRow(this ModelBuilderWrapper modelBuilder)
2019-12-17 13:01:59 +00:00
{
2020-10-10 11:35:05 +00:00
_ = modelBuilder
2020-09-06 22:49:03 +00:00
.Add(MySqlAddDbQuotaRow, Provider.MySql)
2020-10-08 09:07:05 +00:00
.Add(PgSqlAddDbQuotaRow, Provider.Postgre);
2019-12-17 13:01:59 +00:00
return modelBuilder;
}
2020-09-06 22:49:03 +00:00
public static void MySqlAddDbQuotaRow(this ModelBuilder modelBuilder)
2019-12-17 13:01:59 +00:00
{
2020-10-10 11:35:05 +00:00
_ = modelBuilder.Entity<DbQuotaRow>(entity =>
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = entity.HasKey(e => new { e.Tenant, e.Path })
2020-08-21 02:34:37 +00:00
.HasName("PRIMARY");
2019-12-17 13:01:59 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.ToTable("tenants_quotarow");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.HasIndex(e => e.LastModified)
2020-08-21 02:34:37 +00:00
.HasName("last_modified");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Tenant).HasColumnName("tenant");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Path)
2020-08-21 02:34:37 +00:00
.HasColumnName("path")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Counter).HasColumnName("counter");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.LastModified)
2020-08-21 02:34:37 +00:00
.HasColumnName("last_modified")
.HasColumnType("timestamp")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Tag)
2020-08-21 02:34:37 +00:00
.HasColumnName("tag")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
});
Merge branch 'master' into feature/fix-messages # Conflicts: # common/ASC.Core.Common/Billing/TariffService.cs # common/ASC.Core.Common/EF/Context/BaseDbContext.cs # common/ASC.Core.Common/EF/Context/CoreDbContext.cs # common/ASC.Core.Common/EF/Context/DbContext.cs # common/ASC.Core.Common/EF/Context/DbContextManager.cs # common/ASC.Core.Common/EF/Context/FeedDbContext.cs # common/ASC.Core.Common/EF/Context/FilesDbContext.cs # common/ASC.Core.Common/EF/Context/MessagesContext.cs # common/ASC.Core.Common/EF/Context/ResourceDbContext.cs # common/ASC.Core.Common/EF/Context/TelegramDbContext.cs # common/ASC.Core.Common/EF/Context/WebstudioDbContext.cs # common/ASC.Core.Common/EF/Model/AccountLinks.cs # common/ASC.Core.Common/EF/Model/Core/Acl.cs # common/ASC.Core.Common/EF/Model/Core/DbCoreSettings.cs # common/ASC.Core.Common/EF/Model/Core/DbSubscriptionMethod.cs # common/ASC.Core.Common/EF/Model/Core/Subscription.cs # common/ASC.Core.Common/EF/Model/DbWebstudioSettings.cs # common/ASC.Core.Common/EF/Model/DbWebstudioUservisit.cs # common/ASC.Core.Common/EF/Model/Feed/FeedReaded.cs # common/ASC.Core.Common/EF/Model/Feed/FeedUsers.cs # common/ASC.Core.Common/EF/Model/FilesConverts.cs # common/ASC.Core.Common/EF/Model/MobileAppInstall.cs # common/ASC.Core.Common/EF/Model/Resource/ResAuthorsFile.cs # common/ASC.Core.Common/EF/Model/Resource/ResAuthorsLang.cs # common/ASC.Core.Common/EF/Model/TelegramUser.cs # common/ASC.Core.Common/EF/Model/Tenant/DbButton.cs # common/ASC.Core.Common/EF/Model/Tenant/DbQuotaRow.cs # common/ASC.Core.Common/EF/Model/User/UserGroup.cs # common/ASC.Core.Common/HostedSolution.cs # common/ASC.Core.Common/Security/EmailValidationKeyProvider.cs # common/ASC.Data.Reassigns/QueueWorker.cs # common/ASC.Data.Reassigns/ReassignProgressItem.cs # common/ASC.Data.Reassigns/RemoveProgressItem.cs # common/ASC.VoipService/Dao/CachedVoipDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs # products/ASC.Files/Core/Core/EF/DbEncryptedData.cs # products/ASC.Files/Core/Core/EF/DbFile.cs # products/ASC.Files/Core/Core/EF/DbFilesBunchObjects.cs # products/ASC.Files/Core/Core/EF/DbFilesSecurity.cs # products/ASC.Files/Core/Core/EF/DbFilesTagLink.cs # products/ASC.Files/Core/Core/EF/DbFilesThirdpartyApp.cs # products/ASC.Files/Core/Core/EF/DbFilesThirdpartyIdMapping.cs # products/ASC.Files/Core/Core/EF/DbFolderTree.cs # products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs # products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs # products/ASC.Files/Core/Core/Thirdparty/CachedProviderAccountDao.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderSecutiryDao.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderTagDao.cs # products/ASC.Files/Core/Utils/EntryManager.cs # products/ASC.Files/Server/Startup.cs # web/ASC.Web.Studio/Startup.cs
2020-10-09 12:40:44 +00:00
}
2020-09-06 22:49:03 +00:00
public static void PgSqlAddDbQuotaRow(this ModelBuilder modelBuilder)
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = modelBuilder.Entity<DbQuotaRow>(entity =>
2020-08-21 02:34:37 +00:00
{
2020-10-10 11:35:05 +00:00
_ = entity.HasKey(e => new { e.Tenant, e.Path })
2020-08-21 02:34:37 +00:00
.HasName("tenants_quotarow_pkey");
2020-10-10 11:35:05 +00:00
_ = entity.ToTable("tenants_quotarow", "onlyoffice");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.HasIndex(e => e.LastModified)
2020-08-21 02:34:37 +00:00
.HasName("last_modified_tenants_quotarow");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Tenant).HasColumnName("tenant");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Path)
2020-08-21 02:34:37 +00:00
.HasColumnName("path")
.HasMaxLength(255);
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Counter)
2020-08-21 02:34:37 +00:00
.HasColumnName("counter")
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("'0'");
2020-08-21 02:34:37 +00:00
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.LastModified)
2020-08-21 02:34:37 +00:00
.HasColumnName("last_modified")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
2020-10-10 11:35:05 +00:00
_ = entity.Property(e => e.Tag)
2020-08-21 02:34:37 +00:00
.HasColumnName("tag")
.HasMaxLength(1024)
2020-09-29 17:09:39 +00:00
.HasDefaultValueSql("'0'");
2020-08-21 02:34:37 +00:00
});
2019-12-17 13:01:59 +00:00
}
2019-12-02 09:12:16 +00:00
}
}