migration process

This commit is contained in:
Diana 2020-09-29 20:17:06 +03:00
parent 0d74f8d6a2
commit 9e32aaca03
6 changed files with 1705 additions and 10 deletions

View File

@ -164,7 +164,15 @@ namespace ASC.Web.Files
.AddDisplayUserSettingsService()
.AddCommonLinkUtilityService()
.AddFilesDbContextService()
.AddPathProviderService();
.AddPathProviderService()
.AddFeedDbService()
.AddNotifyDbContext()
.AddDbContextService()
.AddResourceDbService()
.AddVoipDbContextService()
.AddMailDbContextService()
.AddMessagesContextService();
}
return services;

View File

@ -0,0 +1,720 @@
// <auto-generated />
using System;
using ASC.Files.Core.EF;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace ASC.Files.Core.Migrations.Npgsql.FilesDbContextNpgsql
{
[DbContext(typeof(FilesDbContext))]
[Migration("20200929105803_FilesDbContextNpgsql")]
partial class FilesDbContextNpgsql
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Alias")
.IsRequired()
.HasColumnName("alias")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<bool>("Calls")
.ValueGeneratedOnAdd()
.HasColumnName("calls")
.HasColumnType("boolean")
.HasDefaultValueSql("1");
b.Property<DateTime>("CreationDateTime")
.HasColumnName("creationdatetime")
.HasColumnType("timestamp without time zone");
b.Property<int?>("Industry")
.HasColumnName("industry")
.HasColumnType("integer");
b.Property<string>("Language")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnName("language")
.HasColumnType("character(10)")
.HasDefaultValueSql("'en-US'")
.IsFixedLength(true)
.HasMaxLength(10);
b.Property<DateTime>("LastModified")
.ValueGeneratedOnAdd()
.HasColumnName("last_modified")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("MappedDomain")
.ValueGeneratedOnAdd()
.HasColumnName("mappeddomain")
.HasColumnType("character varying(100)")
.HasDefaultValueSql("NULL")
.HasMaxLength(100);
b.Property<string>("Name")
.IsRequired()
.HasColumnName("name")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.Property<Guid>("OwnerId")
.ValueGeneratedOnAdd()
.HasColumnName("owner_id")
.HasColumnType("uuid")
.HasDefaultValueSql("NULL")
.HasMaxLength(38);
b.Property<string>("PaymentId")
.ValueGeneratedOnAdd()
.HasColumnName("payment_id")
.HasColumnType("character varying(38)")
.HasDefaultValueSql("NULL")
.HasMaxLength(38);
b.Property<bool>("Public")
.HasColumnName("public")
.HasColumnType("boolean");
b.Property<string>("PublicVisibleProducts")
.ValueGeneratedOnAdd()
.HasColumnName("publicvisibleproducts")
.HasColumnType("character varying(1024)")
.HasDefaultValueSql("NULL")
.HasMaxLength(1024);
b.Property<bool>("Spam")
.ValueGeneratedOnAdd()
.HasColumnName("spam")
.HasColumnType("boolean")
.HasDefaultValueSql("1");
b.Property<int>("Status")
.HasColumnName("status")
.HasColumnType("integer");
b.Property<DateTime?>("StatusChanged")
.HasColumnName("statuschanged")
.HasColumnType("timestamp without time zone");
b.Property<string>("TimeZone")
.ValueGeneratedOnAdd()
.HasColumnName("timezone")
.HasColumnType("character varying(50)")
.HasDefaultValueSql("NULL")
.HasMaxLength(50);
b.Property<string>("TrustedDomains")
.ValueGeneratedOnAdd()
.HasColumnName("trusteddomains")
.HasColumnType("character varying(1024)")
.HasDefaultValueSql("NULL")
.HasMaxLength(1024);
b.Property<int>("TrustedDomainsEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("trusteddomainsenabled")
.HasColumnType("integer")
.HasDefaultValueSql("1");
b.Property<int>("Version")
.ValueGeneratedOnAdd()
.HasColumnName("version")
.HasColumnType("integer")
.HasDefaultValueSql("2");
b.Property<DateTime>("VersionChanged")
.HasColumnName("version_changed")
.HasColumnType("timestamp without time zone");
b.Property<DateTime?>("Version_Changed")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Alias")
.IsUnique()
.HasName("alias");
b.HasIndex("LastModified")
.HasName("last_modified_tenants_tenants");
b.HasIndex("MappedDomain")
.HasName("mappeddomain");
b.HasIndex("Version")
.HasName("version");
b.ToTable("tenants_tenants","onlyoffice");
});
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantPartner", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("AffiliateId")
.HasColumnName("affiliate_id")
.HasColumnType("text");
b.Property<string>("Campaign")
.HasColumnName("campaign")
.HasColumnType("text");
b.Property<string>("PartnerId")
.HasColumnName("partner_id")
.HasColumnType("text");
b.HasKey("TenantId");
b.ToTable("tenants_partners");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbEncryptedData", b =>
{
b.Property<string>("PublicKey")
.HasColumnName("public_key")
.HasColumnType("character(64)")
.IsFixedLength(true)
.HasMaxLength(64);
b.Property<string>("FileHash")
.HasColumnName("file_hash")
.HasColumnType("character(66)")
.IsFixedLength(true)
.HasMaxLength(66);
b.Property<DateTime>("CreateOn")
.ValueGeneratedOnAdd()
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("Data")
.IsRequired()
.HasColumnName("data")
.HasColumnType("character(112)")
.IsFixedLength(true)
.HasMaxLength(112);
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.HasKey("PublicKey", "FileHash")
.HasName("encrypted_data_pkey");
b.HasIndex("TenantId")
.HasName("tenant_id_encrypted_data");
b.ToTable("encrypted_data","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFile", b =>
{
b.Property<int>("Id")
.HasColumnName("id")
.HasColumnType("integer");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<int>("Version")
.HasColumnName("version")
.HasColumnType("integer");
b.Property<int>("Category")
.HasColumnName("category")
.HasColumnType("integer");
b.Property<string>("Changes")
.HasColumnName("changes")
.HasColumnType("text");
b.Property<string>("Comment")
.ValueGeneratedOnAdd()
.HasColumnName("comment")
.HasColumnType("character varying(255)")
.HasDefaultValueSql("NULL::character varying")
.HasMaxLength(255);
b.Property<long>("ContentLength")
.ValueGeneratedOnAdd()
.HasColumnName("content_length")
.HasColumnType("bigint")
.HasDefaultValueSql("'0'::bigint");
b.Property<string>("ConvertedType")
.ValueGeneratedOnAdd()
.HasColumnName("converted_type")
.HasColumnType("character varying(10)")
.HasDefaultValueSql("NULL::character varying")
.HasMaxLength(10);
b.Property<Guid>("CreateBy")
.HasColumnName("create_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<bool>("CurrentVersion")
.HasColumnName("current_version")
.HasColumnType("boolean");
b.Property<bool>("Encrypted")
.HasColumnName("encrypted")
.HasColumnType("boolean");
b.Property<int>("FileStatus")
.HasColumnName("file_status")
.HasColumnType("integer");
b.Property<int>("FolderId")
.HasColumnName("folder_id")
.HasColumnType("integer");
b.Property<int>("Forcesave")
.HasColumnName("forcesave")
.HasColumnType("integer");
b.Property<Guid>("ModifiedBy")
.HasColumnName("modified_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("ModifiedOn")
.HasColumnName("modified_on")
.HasColumnType("timestamp without time zone");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("title")
.HasColumnType("character varying(400)")
.HasMaxLength(400);
b.Property<int>("VersionGroup")
.ValueGeneratedOnAdd()
.HasColumnName("version_group")
.HasColumnType("integer")
.HasDefaultValueSql("1");
b.HasKey("Id", "TenantId", "Version")
.HasName("files_file_pkey");
b.HasIndex("FolderId")
.HasName("folder_id");
b.HasIndex("Id")
.HasName("id");
b.HasIndex("ModifiedOn")
.HasName("modified_on_files_file");
b.ToTable("files_file","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesBunchObjects", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("RightNode")
.HasColumnName("right_node")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.Property<string>("LeftNode")
.IsRequired()
.HasColumnName("left_node")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.HasKey("TenantId", "RightNode")
.HasName("files_bunch_objects_pkey");
b.HasIndex("LeftNode")
.HasName("left_node");
b.ToTable("files_bunch_objects","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesSecurity", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("EntryId")
.HasColumnName("entry_id")
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.Property<int>("EntryType")
.HasColumnName("entry_type")
.HasColumnType("integer");
b.Property<Guid>("Subject")
.HasColumnName("subject")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<Guid>("Owner")
.HasColumnName("owner")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<int>("Security")
.HasColumnName("security")
.HasColumnType("integer");
b.Property<DateTime>("TimeStamp")
.ValueGeneratedOnAdd()
.HasColumnName("timestamp")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.HasKey("TenantId", "EntryId", "EntryType", "Subject")
.HasName("files_security_pkey");
b.HasIndex("Owner")
.HasName("owner");
b.HasIndex("EntryId", "TenantId", "EntryType", "Owner")
.HasName("tenant_id_files_security");
b.ToTable("files_security","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Flag")
.HasColumnName("flag")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("name")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.Property<Guid>("Owner")
.HasColumnName("owner")
.HasColumnType("uuid")
.HasMaxLength(38);
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TenantId", "Owner", "Name", "Flag")
.HasName("name_files_tag");
b.ToTable("files_tag","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesTagLink", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<int>("TagId")
.HasColumnName("tag_id")
.HasColumnType("integer");
b.Property<int>("EntryType")
.HasColumnName("entry_type")
.HasColumnType("integer");
b.Property<string>("EntryId")
.HasColumnName("entry_id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<Guid>("CreateBy")
.ValueGeneratedOnAdd()
.HasColumnName("create_by")
.HasColumnType("uuid")
.HasDefaultValueSql("NULL::bpchar")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("TagCount")
.HasColumnName("tag_count")
.HasColumnType("integer");
b.HasKey("TenantId", "TagId", "EntryType", "EntryId")
.HasName("files_tag_link_pkey");
b.HasIndex("CreateOn")
.HasName("create_on_files_tag_link");
b.HasIndex("TenantId", "EntryType", "EntryId")
.HasName("entry_id");
b.ToTable("files_tag_link","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesThirdpartyAccount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("FolderType")
.HasColumnName("folder_type")
.HasColumnType("integer");
b.Property<string>("Password")
.IsRequired()
.HasColumnName("password")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<string>("Provider")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnName("provider")
.HasColumnType("character varying(50)")
.HasDefaultValueSql("'0'::character varying")
.HasMaxLength(50);
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("customer_title")
.HasColumnType("character varying(400)")
.HasMaxLength(400);
b.Property<string>("Token")
.HasColumnName("token")
.HasColumnType("text");
b.Property<string>("Url")
.HasColumnName("url")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid")
.HasMaxLength(38);
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("files_thirdparty_account","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesThirdpartyApp", b =>
{
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid")
.HasMaxLength(38);
b.Property<string>("App")
.HasColumnName("app")
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.Property<DateTime>("ModifiedOn")
.ValueGeneratedOnAdd()
.HasColumnName("modified_on")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("Token")
.HasColumnName("token")
.HasColumnType("text");
b.HasKey("UserId", "App")
.HasName("files_thirdparty_app_pkey");
b.ToTable("files_thirdparty_app","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesThirdpartyIdMapping", b =>
{
b.Property<string>("HashId")
.HasColumnName("hash_id")
.HasColumnType("character(32)")
.IsFixedLength(true)
.HasMaxLength(32);
b.Property<string>("Id")
.IsRequired()
.HasColumnName("id")
.HasColumnType("text");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.HasKey("HashId")
.HasName("files_thirdparty_id_mapping_pkey");
b.HasIndex("TenantId", "HashId")
.HasName("index_1");
b.ToTable("files_thirdparty_id_mapping","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFolder", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<Guid>("CreateBy")
.HasColumnName("create_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("FilesCount")
.HasColumnName("filesCount")
.HasColumnType("integer");
b.Property<int>("FolderType")
.HasColumnName("folder_type")
.HasColumnType("integer");
b.Property<int>("FoldersCount")
.HasColumnName("foldersCount")
.HasColumnType("integer");
b.Property<Guid>("ModifiedBy")
.HasColumnName("modified_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("ModifiedOn")
.HasColumnName("modified_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("ParentId")
.HasColumnName("parent_id")
.HasColumnType("integer");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("title")
.HasColumnType("character varying(400)")
.HasMaxLength(400);
b.HasKey("Id");
b.HasIndex("ModifiedOn")
.HasName("modified_on_files_folder");
b.HasIndex("TenantId", "ParentId")
.HasName("parent_id");
b.ToTable("files_folder","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFolderTree", b =>
{
b.Property<int>("ParentId")
.HasColumnName("parent_id")
.HasColumnType("integer");
b.Property<int>("FolderId")
.HasColumnName("folder_id")
.HasColumnType("integer");
b.Property<int>("Level")
.HasColumnName("level")
.HasColumnType("integer");
b.HasKey("ParentId", "FolderId")
.HasName("files_folder_tree_pkey");
b.HasIndex("FolderId")
.HasName("folder_id_files_folder_tree");
b.ToTable("files_folder_tree","onlyoffice");
});
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantPartner", b =>
{
b.HasOne("ASC.Core.Common.EF.Model.DbTenant", "Tenant")
.WithOne("Partner")
.HasForeignKey("ASC.Core.Common.EF.Model.DbTenantPartner", "TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,360 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace ASC.Files.Core.Migrations.Npgsql.FilesDbContextNpgsql
{
public partial class FilesDbContextNpgsql : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "onlyoffice");
migrationBuilder.CreateTable(
name: "encrypted_data",
schema: "onlyoffice",
columns: table => new
{
public_key = table.Column<string>(fixedLength: true, maxLength: 64, nullable: false),
file_hash = table.Column<string>(fixedLength: true, maxLength: 66, nullable: false),
data = table.Column<string>(fixedLength: true, maxLength: 112, nullable: false),
create_on = table.Column<DateTime>(nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
tenant_id = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("encrypted_data_pkey", x => new { x.public_key, x.file_hash });
});
migrationBuilder.CreateTable(
name: "files_bunch_objects",
schema: "onlyoffice",
columns: table => new
{
tenant_id = table.Column<int>(nullable: false),
right_node = table.Column<string>(maxLength: 255, nullable: false),
left_node = table.Column<string>(maxLength: 255, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("files_bunch_objects_pkey", x => new { x.tenant_id, x.right_node });
});
migrationBuilder.CreateTable(
name: "files_file",
schema: "onlyoffice",
columns: table => new
{
id = table.Column<int>(nullable: false),
version = table.Column<int>(nullable: false),
tenant_id = table.Column<int>(nullable: false),
version_group = table.Column<int>(nullable: false, defaultValueSql: "1"),
current_version = table.Column<bool>(nullable: false),
folder_id = table.Column<int>(nullable: false),
title = table.Column<string>(maxLength: 400, nullable: false),
content_length = table.Column<long>(nullable: false, defaultValueSql: "'0'::bigint"),
file_status = table.Column<int>(nullable: false),
category = table.Column<int>(nullable: false),
create_by = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false),
create_on = table.Column<DateTime>(nullable: false),
modified_by = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false),
modified_on = table.Column<DateTime>(nullable: false),
converted_type = table.Column<string>(maxLength: 10, nullable: true, defaultValueSql: "NULL::character varying"),
comment = table.Column<string>(maxLength: 255, nullable: true, defaultValueSql: "NULL::character varying"),
changes = table.Column<string>(nullable: true),
encrypted = table.Column<bool>(nullable: false),
forcesave = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("files_file_pkey", x => new { x.id, x.tenant_id, x.version });
});
migrationBuilder.CreateTable(
name: "files_folder",
schema: "onlyoffice",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
parent_id = table.Column<int>(nullable: false),
title = table.Column<string>(maxLength: 400, nullable: false),
folder_type = table.Column<int>(nullable: false),
create_by = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false),
create_on = table.Column<DateTime>(nullable: false),
modified_by = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false),
modified_on = table.Column<DateTime>(nullable: false),
tenant_id = table.Column<int>(nullable: false),
foldersCount = table.Column<int>(nullable: false),
filesCount = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_files_folder", x => x.id);
});
migrationBuilder.CreateTable(
name: "files_folder_tree",
schema: "onlyoffice",
columns: table => new
{
folder_id = table.Column<int>(nullable: false),
parent_id = table.Column<int>(nullable: false),
level = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("files_folder_tree_pkey", x => new { x.parent_id, x.folder_id });
});
migrationBuilder.CreateTable(
name: "files_security",
schema: "onlyoffice",
columns: table => new
{
tenant_id = table.Column<int>(nullable: false),
entry_id = table.Column<string>(maxLength: 50, nullable: false),
entry_type = table.Column<int>(nullable: false),
subject = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false),
owner = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false),
security = table.Column<int>(nullable: false),
timestamp = table.Column<DateTime>(nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("files_security_pkey", x => new { x.tenant_id, x.entry_id, x.entry_type, x.subject });
});
migrationBuilder.CreateTable(
name: "files_tag",
schema: "onlyoffice",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
tenant_id = table.Column<int>(nullable: false),
name = table.Column<string>(maxLength: 255, nullable: false),
owner = table.Column<Guid>(maxLength: 38, nullable: false),
flag = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_files_tag", x => x.id);
});
migrationBuilder.CreateTable(
name: "files_tag_link",
schema: "onlyoffice",
columns: table => new
{
tenant_id = table.Column<int>(nullable: false),
tag_id = table.Column<int>(nullable: false),
entry_type = table.Column<int>(nullable: false),
entry_id = table.Column<string>(maxLength: 32, nullable: false),
create_by = table.Column<Guid>(fixedLength: true, maxLength: 38, nullable: false, defaultValueSql: "NULL"),
create_on = table.Column<DateTime>(nullable: false),
tag_count = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("files_tag_link_pkey", x => new { x.tenant_id, x.tag_id, x.entry_type, x.entry_id });
});
migrationBuilder.CreateTable(
name: "files_thirdparty_account",
schema: "onlyoffice",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
provider = table.Column<string>(maxLength: 50, nullable: false, defaultValueSql: "'0'::character varying"),
customer_title = table.Column<string>(maxLength: 400, nullable: false),
user_name = table.Column<string>(maxLength: 100, nullable: false),
password = table.Column<string>(maxLength: 100, nullable: false),
token = table.Column<string>(nullable: true),
user_id = table.Column<Guid>(maxLength: 38, nullable: false),
folder_type = table.Column<int>(nullable: false),
create_on = table.Column<DateTime>(nullable: false),
url = table.Column<string>(nullable: true),
tenant_id = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_files_thirdparty_account", x => x.id);
});
migrationBuilder.CreateTable(
name: "files_thirdparty_app",
schema: "onlyoffice",
columns: table => new
{
user_id = table.Column<Guid>(maxLength: 38, nullable: false),
app = table.Column<string>(maxLength: 50, nullable: false),
token = table.Column<string>(nullable: true),
tenant_id = table.Column<int>(nullable: false),
modified_on = table.Column<DateTime>(nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("files_thirdparty_app_pkey", x => new { x.user_id, x.app });
});
migrationBuilder.CreateTable(
name: "files_thirdparty_id_mapping",
schema: "onlyoffice",
columns: table => new
{
hash_id = table.Column<string>(fixedLength: true, maxLength: 32, nullable: false),
tenant_id = table.Column<int>(nullable: false),
id = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("files_thirdparty_id_mapping_pkey", x => x.hash_id);
});
migrationBuilder.CreateIndex(
name: "tenant_id_encrypted_data",
schema: "onlyoffice",
table: "encrypted_data",
column: "tenant_id");
migrationBuilder.CreateIndex(
name: "left_node",
schema: "onlyoffice",
table: "files_bunch_objects",
column: "left_node");
migrationBuilder.CreateIndex(
name: "folder_id",
schema: "onlyoffice",
table: "files_file",
column: "folder_id");
migrationBuilder.CreateIndex(
name: "id",
schema: "onlyoffice",
table: "files_file",
column: "id");
migrationBuilder.CreateIndex(
name: "modified_on_files_file",
schema: "onlyoffice",
table: "files_file",
column: "modified_on");
migrationBuilder.CreateIndex(
name: "modified_on_files_folder",
schema: "onlyoffice",
table: "files_folder",
column: "modified_on");
migrationBuilder.CreateIndex(
name: "parent_id",
schema: "onlyoffice",
table: "files_folder",
columns: new[] { "tenant_id", "parent_id" });
migrationBuilder.CreateIndex(
name: "folder_id_files_folder_tree",
schema: "onlyoffice",
table: "files_folder_tree",
column: "folder_id");
migrationBuilder.CreateIndex(
name: "owner",
schema: "onlyoffice",
table: "files_security",
column: "owner");
migrationBuilder.CreateIndex(
name: "tenant_id_files_security",
schema: "onlyoffice",
table: "files_security",
columns: new[] { "entry_id", "tenant_id", "entry_type", "owner" });
migrationBuilder.CreateIndex(
name: "name_files_tag",
schema: "onlyoffice",
table: "files_tag",
columns: new[] { "tenant_id", "owner", "name", "flag" });
migrationBuilder.CreateIndex(
name: "create_on_files_tag_link",
schema: "onlyoffice",
table: "files_tag_link",
column: "create_on");
migrationBuilder.CreateIndex(
name: "entry_id",
schema: "onlyoffice",
table: "files_tag_link",
columns: new[] { "tenant_id", "entry_type", "entry_id" });
migrationBuilder.CreateIndex(
name: "index_1",
schema: "onlyoffice",
table: "files_thirdparty_id_mapping",
columns: new[] { "tenant_id", "hash_id" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "tenants_partners");
migrationBuilder.DropTable(
name: "encrypted_data",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_bunch_objects",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_file",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_folder",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_folder_tree",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_security",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_tag",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_tag_link",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_thirdparty_account",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_thirdparty_app",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "files_thirdparty_id_mapping",
schema: "onlyoffice");
migrationBuilder.DropTable(
name: "tenants_tenants",
schema: "onlyoffice");
}
}
}

View File

@ -0,0 +1,549 @@
// <auto-generated />
using System;
using ASC.Files.Core.EF;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace ASC.Files.Core.Migrations.Npgsql.FilesDbContextNpgsql
{
[DbContext(typeof(FilesDbContext))]
partial class FilesDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("ASC.Files.Core.EF.DbEncryptedData", b =>
{
b.Property<string>("PublicKey")
.HasColumnName("public_key")
.HasColumnType("character(64)")
.IsFixedLength(true)
.HasMaxLength(64);
b.Property<string>("FileHash")
.HasColumnName("file_hash")
.HasColumnType("character(66)")
.IsFixedLength(true)
.HasMaxLength(66);
b.Property<DateTime>("CreateOn")
.ValueGeneratedOnAdd()
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("Data")
.IsRequired()
.HasColumnName("data")
.HasColumnType("character(112)")
.IsFixedLength(true)
.HasMaxLength(112);
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.HasKey("PublicKey", "FileHash")
.HasName("encrypted_data_pkey");
b.HasIndex("TenantId")
.HasName("tenant_id_encrypted_data");
b.ToTable("encrypted_data","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFile", b =>
{
b.Property<int>("Id")
.HasColumnName("id")
.HasColumnType("integer");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<int>("Version")
.HasColumnName("version")
.HasColumnType("integer");
b.Property<int>("Category")
.HasColumnName("category")
.HasColumnType("integer");
b.Property<string>("Changes")
.HasColumnName("changes")
.HasColumnType("text");
b.Property<string>("Comment")
.ValueGeneratedOnAdd()
.HasColumnName("comment")
.HasColumnType("character varying(255)")
.HasDefaultValueSql("NULL::character varying")
.HasMaxLength(255);
b.Property<long>("ContentLength")
.ValueGeneratedOnAdd()
.HasColumnName("content_length")
.HasColumnType("bigint")
.HasDefaultValueSql("'0'::bigint");
b.Property<string>("ConvertedType")
.ValueGeneratedOnAdd()
.HasColumnName("converted_type")
.HasColumnType("character varying(10)")
.HasDefaultValueSql("NULL::character varying")
.HasMaxLength(10);
b.Property<Guid>("CreateBy")
.HasColumnName("create_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<bool>("CurrentVersion")
.HasColumnName("current_version")
.HasColumnType("boolean");
b.Property<bool>("Encrypted")
.HasColumnName("encrypted")
.HasColumnType("boolean");
b.Property<int>("FileStatus")
.HasColumnName("file_status")
.HasColumnType("integer");
b.Property<int>("FolderId")
.HasColumnName("folder_id")
.HasColumnType("integer");
b.Property<int>("Forcesave")
.HasColumnName("forcesave")
.HasColumnType("integer");
b.Property<Guid>("ModifiedBy")
.HasColumnName("modified_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("ModifiedOn")
.HasColumnName("modified_on")
.HasColumnType("timestamp without time zone");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("title")
.HasColumnType("character varying(400)")
.HasMaxLength(400);
b.Property<int>("VersionGroup")
.ValueGeneratedOnAdd()
.HasColumnName("version_group")
.HasColumnType("integer")
.HasDefaultValueSql("1");
b.HasKey("Id", "TenantId", "Version")
.HasName("files_file_pkey");
b.HasIndex("FolderId")
.HasName("folder_id");
b.HasIndex("Id")
.HasName("id");
b.HasIndex("ModifiedOn")
.HasName("modified_on_files_file");
b.ToTable("files_file","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesBunchObjects", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("RightNode")
.HasColumnName("right_node")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.Property<string>("LeftNode")
.IsRequired()
.HasColumnName("left_node")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.HasKey("TenantId", "RightNode")
.HasName("files_bunch_objects_pkey");
b.HasIndex("LeftNode")
.HasName("left_node");
b.ToTable("files_bunch_objects","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesSecurity", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("EntryId")
.HasColumnName("entry_id")
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.Property<int>("EntryType")
.HasColumnName("entry_type")
.HasColumnType("integer");
b.Property<Guid>("Subject")
.HasColumnName("subject")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<Guid>("Owner")
.HasColumnName("owner")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<int>("Security")
.HasColumnName("security")
.HasColumnType("integer");
b.Property<DateTime>("TimeStamp")
.ValueGeneratedOnAdd()
.HasColumnName("timestamp")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.HasKey("TenantId", "EntryId", "EntryType", "Subject")
.HasName("files_security_pkey");
b.HasIndex("Owner")
.HasName("owner");
b.HasIndex("EntryId", "TenantId", "EntryType", "Owner")
.HasName("tenant_id_files_security");
b.ToTable("files_security","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Flag")
.HasColumnName("flag")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("name")
.HasColumnType("character varying(255)")
.HasMaxLength(255);
b.Property<Guid>("Owner")
.HasColumnName("owner")
.HasColumnType("uuid")
.HasMaxLength(38);
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TenantId", "Owner", "Name", "Flag")
.HasName("name_files_tag");
b.ToTable("files_tag","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesTagLink", b =>
{
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<int>("TagId")
.HasColumnName("tag_id")
.HasColumnType("integer");
b.Property<int>("EntryType")
.HasColumnName("entry_type")
.HasColumnType("integer");
b.Property<string>("EntryId")
.HasColumnName("entry_id")
.HasColumnType("character varying(32)")
.HasMaxLength(32);
b.Property<Guid>("CreateBy")
.ValueGeneratedOnAdd()
.HasColumnName("create_by")
.HasColumnType("uuid")
.HasDefaultValueSql("NULL")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("TagCount")
.HasColumnName("tag_count")
.HasColumnType("integer");
b.HasKey("TenantId", "TagId", "EntryType", "EntryId")
.HasName("files_tag_link_pkey");
b.HasIndex("CreateOn")
.HasName("create_on_files_tag_link");
b.HasIndex("TenantId", "EntryType", "EntryId")
.HasName("entry_id");
b.ToTable("files_tag_link","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesThirdpartyAccount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("FolderType")
.HasColumnName("folder_type")
.HasColumnType("integer");
b.Property<string>("Password")
.IsRequired()
.HasColumnName("password")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<string>("Provider")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnName("provider")
.HasColumnType("character varying(50)")
.HasDefaultValueSql("'0'::character varying")
.HasMaxLength(50);
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("customer_title")
.HasColumnType("character varying(400)")
.HasMaxLength(400);
b.Property<string>("Token")
.HasColumnName("token")
.HasColumnType("text");
b.Property<string>("Url")
.HasColumnName("url")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid")
.HasMaxLength(38);
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("user_name")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("files_thirdparty_account","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesThirdpartyApp", b =>
{
b.Property<Guid>("UserId")
.HasColumnName("user_id")
.HasColumnType("uuid")
.HasMaxLength(38);
b.Property<string>("App")
.HasColumnName("app")
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.Property<DateTime>("ModifiedOn")
.ValueGeneratedOnAdd()
.HasColumnName("modified_on")
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("Token")
.HasColumnName("token")
.HasColumnType("text");
b.HasKey("UserId", "App")
.HasName("files_thirdparty_app_pkey");
b.ToTable("files_thirdparty_app","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFilesThirdpartyIdMapping", b =>
{
b.Property<string>("HashId")
.HasColumnName("hash_id")
.HasColumnType("character(32)")
.IsFixedLength(true)
.HasMaxLength(32);
b.Property<string>("Id")
.IsRequired()
.HasColumnName("id")
.HasColumnType("text");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.HasKey("HashId")
.HasName("files_thirdparty_id_mapping_pkey");
b.HasIndex("TenantId", "HashId")
.HasName("index_1");
b.ToTable("files_thirdparty_id_mapping","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFolder", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<Guid>("CreateBy")
.HasColumnName("create_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("CreateOn")
.HasColumnName("create_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("FilesCount")
.HasColumnName("filesCount")
.HasColumnType("integer");
b.Property<int>("FolderType")
.HasColumnName("folder_type")
.HasColumnType("integer");
b.Property<int>("FoldersCount")
.HasColumnName("foldersCount")
.HasColumnType("integer");
b.Property<Guid>("ModifiedBy")
.HasColumnName("modified_by")
.HasColumnType("uuid")
.IsFixedLength(true)
.HasMaxLength(38);
b.Property<DateTime>("ModifiedOn")
.HasColumnName("modified_on")
.HasColumnType("timestamp without time zone");
b.Property<int>("ParentId")
.HasColumnName("parent_id")
.HasColumnType("integer");
b.Property<int>("TenantId")
.HasColumnName("tenant_id")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("title")
.HasColumnType("character varying(400)")
.HasMaxLength(400);
b.HasKey("Id");
b.HasIndex("ModifiedOn")
.HasName("modified_on_files_folder");
b.HasIndex("TenantId", "ParentId")
.HasName("parent_id");
b.ToTable("files_folder","onlyoffice");
});
modelBuilder.Entity("ASC.Files.Core.EF.DbFolderTree", b =>
{
b.Property<int>("ParentId")
.HasColumnName("parent_id")
.HasColumnType("integer");
b.Property<int>("FolderId")
.HasColumnName("folder_id")
.HasColumnType("integer");
b.Property<int>("Level")
.HasColumnName("level")
.HasColumnType("integer");
b.HasKey("ParentId", "FolderId")
.HasName("files_folder_tree_pkey");
b.HasIndex("FolderId")
.HasName("folder_id_files_folder_tree");
b.ToTable("files_folder_tree","onlyoffice");
});
modelBuilder.Entity("ASC.Core.Common.EF.Model.DbTenantPartner", b =>
{
b.HasOne("ASC.Core.Common.EF.Model.DbTenant", "Tenant")
.WithOne("Partner")
.HasForeignKey("ASC.Core.Common.EF.Model.DbTenantPartner", "TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@ -29,6 +29,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.OneDriveSDK" Version="2.0.7" />
<PackageReference Include="Microsoft.SharePoint.Client" Version="14.0.4762.1000" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />

View File

@ -13,6 +13,7 @@ using ASC.Web.Files.HttpHandlers;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@ -49,20 +50,73 @@ namespace ASC.Files
base.ConfigureServices(services);
}
public void Migrations(IApplicationBuilder app)
{
using (var Service = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope())
{
using (var Base = Service.ServiceProvider.GetService<DbContextManager<AccountLinkContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<FilesDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<CoreDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<TenantDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<UserDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<WebstudioDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<FeedDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<NotifyDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<ASC.Core.Common.EF.Context.DbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<ResourceDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<VoipDbContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<MessagesContext>>())
{
Base.Value.Database.Migrate();
}
using (var Base = Service.ServiceProvider.GetService<DbContextManager<ASC.Files.Core.EF.FilesDbContext>>())
{
Base.Value.Database.Migrate();
}
}
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
base.Configure(app, env);
using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
{
var context_1 = serviceScope.ServiceProvider.GetRequiredService<DbContextManager<FilesDbContext>>();
context_1.Value.Database.EnsureCreated();
}
Migrations(app);
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/filehandler.ashx"),
appBranch =>