72 lines
2.6 KiB
C#
72 lines
2.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace ViraScraper.Migrations
|
|
{
|
|
public partial class Init : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Hashtags",
|
|
columns: table => new
|
|
{
|
|
HashtagId = table.Column<int>(nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Tag = table.Column<string>(nullable: true),
|
|
CreationDate = table.Column<DateTime>(nullable: false),
|
|
HashtagType = table.Column<int>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Hashtags", x => x.HashtagId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Synonymses",
|
|
columns: table => new
|
|
{
|
|
SynonymsId = table.Column<int>(nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
HashtagAId = table.Column<int>(nullable: false),
|
|
HashtagBId = table.Column<int>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Synonymses", x => x.SynonymsId);
|
|
table.ForeignKey(
|
|
name: "FK_Synonymses_Hashtags_HashtagAId",
|
|
column: x => x.HashtagAId,
|
|
principalTable: "Hashtags",
|
|
principalColumn: "HashtagId",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Synonymses_Hashtags_HashtagBId",
|
|
column: x => x.HashtagBId,
|
|
principalTable: "Hashtags",
|
|
principalColumn: "HashtagId",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Synonymses_HashtagAId",
|
|
table: "Synonymses",
|
|
column: "HashtagAId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Synonymses_HashtagBId",
|
|
table: "Synonymses",
|
|
column: "HashtagBId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Synonymses");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Hashtags");
|
|
}
|
|
}
|
|
}
|