DocSpace-client/migrations/mysql/UrlShortenerFakeDbContext/20220724114554_UrlShortenerFakeDbContextMigrate.cs

47 lines
1.8 KiB
C#

using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ASC.Migrations.MySql.Migrations
{
public partial class UrlShortenerFakeDbContextMigrate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "short_links",
columns: table => new
{
id = table.Column<int>(type: "int(10)", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
@short = table.Column<string>(name: "short", type: "varchar(12)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
link = table.Column<string>(type: "text", nullable: true, collation: "utf8_bin")
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.id);
})
.Annotation("MySql:CharSet", "utf8")
.Annotation("Relational:Collation", "utf8_general_ci");
migrationBuilder.CreateIndex(
name: "IX_short_links_short",
table: "short_links",
column: "short",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "short_links");
}
}
}