104 lines
5.3 KiB
C#
104 lines
5.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ASC.Migrations.MySql.Migrations
|
|
{
|
|
public partial class CustomDbContextMigrate : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "dbip_location",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
addr_type = table.Column<string>(type: "enum('ipv4','ipv6')", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
ip_start = table.Column<string>(type: "varchar(39)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
ip_end = table.Column<string>(type: "varchar(39)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
country = table.Column<string>(type: "varchar(2)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
stateprov = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
district = table.Column<string>(type: "varchar(255)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
city = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
zipcode = table.Column<string>(type: "varchar(255)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
latitude = table.Column<float>(type: "float", nullable: true, defaultValueSql: "NULL"),
|
|
longitude = table.Column<float>(type: "float", nullable: true, defaultValueSql: "NULL"),
|
|
geoname_id = table.Column<int>(type: "int", nullable: true, defaultValueSql: "NULL"),
|
|
timezone_offset = table.Column<int>(type: "int", nullable: true, defaultValueSql: "NULL"),
|
|
timezone_name = table.Column<string>(type: "varchar(255)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
processed = table.Column<int>(type: "int", nullable: false, defaultValueSql: "'1'")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_dbip_location", x => x.id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "mobile_app_install",
|
|
columns: table => new
|
|
{
|
|
user_email = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
app_type = table.Column<int>(type: "int", nullable: false),
|
|
registered_on = table.Column<DateTime>(type: "datetime", nullable: false),
|
|
last_sign = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "NULL")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PRIMARY", x => new { x.user_email, x.app_type });
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Regions",
|
|
columns: table => new
|
|
{
|
|
Region = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
Provider = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
ConnectionString = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Regions", x => x.Region);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ip_start",
|
|
table: "dbip_location",
|
|
column: "ip_start");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "dbip_location");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "mobile_app_install");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Regions");
|
|
}
|
|
}
|
|
}
|