40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace ASC.Migrations.PostgreSql.Migrations
|
|
{
|
|
public partial class UrlShortenerFakeDbContextMigrate : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "short_links",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int(10)", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
@short = table.Column<string>(name: "short", type: "varchar(12)", nullable: true, collation: "utf8_general_ci"),
|
|
link = table.Column<string>(type: "text", nullable: true, collation: "utf8_bin")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PRIMARY", x => x.id);
|
|
});
|
|
|
|
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");
|
|
}
|
|
}
|
|
}
|