using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ASC.Migrations.PostgreSql.Migrations { public partial class CustomDbContextMigrate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( name: "onlyoffice"); migrationBuilder.AlterDatabase() .Annotation("Npgsql:Enum:onlyoffice.enum_dbip_location", "ipv4,ipv6"); migrationBuilder.CreateTable( name: "dbip_location", schema: "onlyoffice", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), AddrType = table.Column(type: "text", nullable: true), ip_start = table.Column(type: "character varying(39)", maxLength: 39, nullable: false), ip_end = table.Column(type: "character varying(39)", maxLength: 39, nullable: false), country = table.Column(type: "character varying(2)", maxLength: 2, nullable: false), stateprov = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), district = table.Column(type: "character varying(255)", maxLength: 255, nullable: true, defaultValueSql: "NULL"), city = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), zipcode = table.Column(type: "character varying(255)", maxLength: 255, nullable: true, defaultValueSql: "NULL"), latitude = table.Column(type: "bigint", nullable: true), longitude = table.Column(type: "bigint", nullable: true), geoname_id = table.Column(type: "integer", nullable: true), timezone_offset = table.Column(type: "double precision", nullable: true), timezone_name = table.Column(type: "character varying(255)", maxLength: 255, nullable: true, defaultValueSql: "NULL"), processed = table.Column(type: "integer", nullable: false, defaultValueSql: "1") }, constraints: table => { table.PrimaryKey("PK_dbip_location", x => x.id); }); migrationBuilder.CreateTable( name: "mobile_app_install", schema: "onlyoffice", columns: table => new { user_email = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), app_type = table.Column(type: "integer", nullable: false), registered_on = table.Column(type: "timestamp with time zone", nullable: false), last_sign = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("mobile_app_install_pkey", x => new { x.user_email, x.app_type }); }); migrationBuilder.CreateTable( name: "Regions", columns: table => new { Region = table.Column(type: "text", nullable: false), Provider = table.Column(type: "text", nullable: true), ConnectionString = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Regions", x => x.Region); }); migrationBuilder.CreateIndex( name: "ip_start", schema: "onlyoffice", table: "dbip_location", column: "ip_start"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "dbip_location", schema: "onlyoffice"); migrationBuilder.DropTable( name: "mobile_app_install", schema: "onlyoffice"); migrationBuilder.DropTable( name: "Regions"); } } }