using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ASC.Migrations.PostgreSql.Migrations { public partial class TenantDbContextMigrate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( name: "onlyoffice"); migrationBuilder.CreateTable( name: "core_settings", schema: "onlyoffice", columns: table => new { tenant = table.Column(type: "integer", nullable: false), id = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), value = table.Column(type: "bytea", nullable: false), last_modified = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP") }, constraints: table => { table.PrimaryKey("core_settings_pkey", x => new { x.tenant, x.id }); }); migrationBuilder.CreateTable( name: "tenants_forbiden", schema: "onlyoffice", columns: table => new { address = table.Column(type: "character varying(50)", maxLength: 50, nullable: false) }, constraints: table => { table.PrimaryKey("tenants_forbiden_pkey", x => x.address); }); migrationBuilder.CreateTable( name: "tenants_iprestrictions", schema: "onlyoffice", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), tenant = table.Column(type: "integer", nullable: false), ip = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), for_admin = table.Column(type: "TINYINT(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_tenants_iprestrictions", x => x.id); }); migrationBuilder.CreateTable( name: "tenants_tenants", schema: "onlyoffice", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), alias = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), mappeddomain = table.Column(type: "character varying(100)", maxLength: 100, nullable: true, defaultValueSql: "NULL"), version = table.Column(type: "integer", nullable: false, defaultValueSql: "2"), version_changed = table.Column(type: "timestamp with time zone", nullable: true), language = table.Column(type: "character(10)", fixedLength: true, maxLength: 10, nullable: false, defaultValueSql: "'en-US'"), timezone = table.Column(type: "character varying(50)", maxLength: 50, nullable: true, defaultValueSql: "NULL"), trusteddomains = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true, defaultValueSql: "NULL"), trusteddomainsenabled = table.Column(type: "integer", nullable: false, defaultValueSql: "1"), status = table.Column(type: "integer", nullable: false), statuschanged = table.Column(type: "timestamp with time zone", nullable: true), creationdatetime = table.Column(type: "timestamp with time zone", nullable: false), owner_id = table.Column(type: "uuid", maxLength: 38, nullable: true, defaultValueSql: "NULL"), payment_id = table.Column(type: "character varying(38)", maxLength: 38, nullable: true, defaultValueSql: "NULL"), industry = table.Column(type: "integer", nullable: false), last_modified = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), spam = table.Column(type: "boolean", nullable: false, defaultValueSql: "true"), calls = table.Column(type: "boolean", nullable: false, defaultValueSql: "true") }, constraints: table => { table.PrimaryKey("PK_tenants_tenants", x => x.id); }); migrationBuilder.CreateTable( name: "tenants_version", schema: "onlyoffice", columns: table => new { id = table.Column(type: "integer", nullable: false), version = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), url = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), default_version = table.Column(type: "integer", nullable: false), visible = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_tenants_version", x => x.id); }); migrationBuilder.InsertData( schema: "onlyoffice", table: "core_settings", columns: new[] { "id", "tenant", "last_modified", "value" }, values: new object[,] { { "CompanyWhiteLabelSettings", -1, new DateTime(2022, 7, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), new byte[] { 245, 71, 4, 138, 72, 101, 23, 21, 135, 217, 206, 188, 138, 73, 108, 96, 29, 150, 3, 31, 44, 28, 62, 145, 96, 53, 57, 66, 238, 118, 93, 172, 211, 22, 244, 181, 244, 40, 146, 67, 111, 196, 162, 27, 154, 109, 248, 255, 181, 17, 253, 127, 42, 65, 19, 90, 26, 206, 203, 145, 159, 159, 243, 105, 24, 71, 188, 165, 53, 85, 57, 37, 186, 251, 57, 96, 18, 162, 218, 80, 0, 101, 250, 100, 66, 97, 24, 51, 240, 215, 216, 169, 105, 100, 15, 253, 29, 83, 182, 236, 203, 53, 68, 251, 2, 150, 149, 148, 58, 136, 84, 37, 151, 82, 92, 227, 30, 52, 111, 40, 154, 155, 7, 126, 149, 100, 169, 87, 10, 129, 228, 138, 177, 101, 77, 67, 177, 216, 189, 201, 1, 213, 136, 216, 107, 198, 253, 221, 106, 255, 198, 17, 68, 14, 110, 90, 174, 182, 68, 222, 188, 77, 157, 19, 26, 68, 86, 97, 15, 81, 24, 171, 214, 114, 191, 175, 56, 56, 48, 52, 125, 82, 253, 113, 71, 41, 201, 5, 8, 118, 162, 191, 99, 196, 48, 198, 223, 79, 204, 174, 31, 97, 236, 20, 213, 218, 85, 34, 16, 74, 196, 209, 235, 14, 71, 209, 32, 131, 195, 84, 11, 66, 74, 19, 115, 255, 99, 69, 235, 210, 204, 15, 13, 4, 143, 127, 152, 125, 212, 91 } }, { "FullTextSearchSettings", -1, new DateTime(2022, 7, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), new byte[] { 8, 120, 207, 5, 153, 181, 23, 202, 162, 211, 218, 237, 157, 6, 76, 62, 220, 238, 175, 67, 31, 53, 166, 246, 66, 220, 173, 160, 72, 23, 227, 81, 50, 39, 187, 177, 222, 110, 43, 171, 235, 158, 16, 119, 178, 207, 49, 140, 72, 152, 20, 84, 94, 135, 117, 1, 246, 51, 251, 190, 148, 2, 44, 252, 221, 2, 91, 83, 149, 151, 58, 245, 16, 148, 52, 8, 187, 86, 150, 46, 227, 93, 163, 95, 47, 131, 116, 207, 95, 209, 38, 149, 53, 148, 73, 215, 206, 251, 194, 199, 189, 17, 42, 229, 135, 82, 23, 154, 162, 165, 158, 94, 23, 128, 30, 88, 12, 204, 96, 250, 236, 142, 189, 211, 214, 18, 196, 136, 102, 102, 217, 109, 108, 240, 96, 96, 94, 100, 201, 10, 31, 170, 128, 192 } }, { "SmtpSettings", -1, new DateTime(2022, 7, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), new byte[] { 240, 82, 224, 144, 161, 163, 117, 13, 173, 205, 78, 153, 97, 218, 4, 170, 81, 239, 1, 151, 226, 192, 98, 60, 241, 44, 88, 56, 191, 164, 10, 155, 72, 186, 239, 203, 227, 113, 88, 119, 49, 215, 227, 220, 158, 124, 96, 9, 116, 47, 158, 65, 93, 86, 219, 15, 10, 224, 142, 50, 248, 144, 75, 44, 68, 28, 198, 87, 198, 69, 67, 234, 238, 38, 32, 68, 162, 139, 67, 53, 220, 176, 240, 196, 233, 64, 29, 137, 31, 160, 99, 105, 249, 132, 202, 45, 71, 92, 134, 194, 55, 145, 121, 97, 197, 130, 119, 105, 131, 21, 133, 35, 10, 102, 172, 119, 135, 230, 251, 86, 253, 62, 55, 56, 146, 103, 164, 106 } } }); migrationBuilder.InsertData( schema: "onlyoffice", table: "tenants_forbiden", column: "address", values: new object[] { "controlpanel", "localhost" }); migrationBuilder.InsertData( schema: "onlyoffice", table: "tenants_tenants", columns: new[] { "id", "alias", "creationdatetime", "industry", "last_modified", "name", "owner_id", "status", "statuschanged", "version_changed" }, values: new object[] { 1, "localhost", new DateTime(2021, 3, 9, 17, 46, 59, 97, DateTimeKind.Utc).AddTicks(4317), 0, new DateTime(2022, 7, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), "Web Office", new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), 0, null, null }); migrationBuilder.CreateIndex( name: "tenant_tenants_iprestrictions", schema: "onlyoffice", table: "tenants_iprestrictions", column: "tenant"); migrationBuilder.CreateIndex( name: "alias", schema: "onlyoffice", table: "tenants_tenants", column: "alias", unique: true); migrationBuilder.CreateIndex( name: "last_modified_tenants_tenants", schema: "onlyoffice", table: "tenants_tenants", column: "last_modified"); migrationBuilder.CreateIndex( name: "mappeddomain", schema: "onlyoffice", table: "tenants_tenants", column: "mappeddomain"); migrationBuilder.CreateIndex( name: "version", schema: "onlyoffice", table: "tenants_tenants", column: "version"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "core_settings", schema: "onlyoffice"); migrationBuilder.DropTable( name: "tenants_forbiden", schema: "onlyoffice"); migrationBuilder.DropTable( name: "tenants_iprestrictions", schema: "onlyoffice"); migrationBuilder.DropTable( name: "tenants_tenants", schema: "onlyoffice"); migrationBuilder.DropTable( name: "tenants_version", schema: "onlyoffice"); } } }