using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { public partial class waifus : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DiscordUser", columns: table => new { Id = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), AvatarId = table.Column(nullable: true), Discriminator = table.Column(nullable: true), UserId = table.Column(nullable: false), Username = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_DiscordUser", x => x.Id); table.UniqueConstraint("AK_DiscordUser_UserId", x => x.UserId); }); migrationBuilder.CreateTable( name: "WaifuInfo", columns: table => new { Id = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), AffinityId = table.Column(nullable: true), ClaimerId = table.Column(nullable: true), Price = table.Column(nullable: false), WaifuId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_WaifuInfo", x => x.Id); table.ForeignKey( name: "FK_WaifuInfo_DiscordUser_AffinityId", column: x => x.AffinityId, principalTable: "DiscordUser", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WaifuInfo_DiscordUser_ClaimerId", column: x => x.ClaimerId, principalTable: "DiscordUser", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WaifuInfo_DiscordUser_WaifuId", column: x => x.WaifuId, principalTable: "DiscordUser", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "WaifuUpdates", columns: table => new { Id = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), NewId = table.Column(nullable: true), OldId = table.Column(nullable: true), UpdateType = table.Column(nullable: false), UserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_WaifuUpdates", x => x.Id); table.ForeignKey( name: "FK_WaifuUpdates_DiscordUser_NewId", column: x => x.NewId, principalTable: "DiscordUser", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WaifuUpdates_DiscordUser_OldId", column: x => x.OldId, principalTable: "DiscordUser", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WaifuUpdates_DiscordUser_UserId", column: x => x.UserId, principalTable: "DiscordUser", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_WaifuInfo_AffinityId", table: "WaifuInfo", column: "AffinityId"); migrationBuilder.CreateIndex( name: "IX_WaifuInfo_ClaimerId", table: "WaifuInfo", column: "ClaimerId"); migrationBuilder.CreateIndex( name: "IX_WaifuInfo_WaifuId", table: "WaifuInfo", column: "WaifuId", unique: true); migrationBuilder.CreateIndex( name: "IX_WaifuUpdates_NewId", table: "WaifuUpdates", column: "NewId"); migrationBuilder.CreateIndex( name: "IX_WaifuUpdates_OldId", table: "WaifuUpdates", column: "OldId"); migrationBuilder.CreateIndex( name: "IX_WaifuUpdates_UserId", table: "WaifuUpdates", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WaifuInfo"); migrationBuilder.DropTable( name: "WaifuUpdates"); migrationBuilder.DropTable( name: "DiscordUser"); } } }