101 lines
3.9 KiB
C#
101 lines
3.9 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace NadekoBot.Migrations
|
|
{
|
|
public partial class pollrewrite : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Poll",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
|
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
|
Question = table.Column<string>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Poll", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PollAnswer",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
Index = table.Column<int>(type: "INTEGER", nullable: false),
|
|
PollId = table.Column<int>(type: "INTEGER", nullable: true),
|
|
Text = table.Column<string>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PollAnswer", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_PollAnswer_Poll_PollId",
|
|
column: x => x.PollId,
|
|
principalTable: "Poll",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PollVote",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
PollId = table.Column<int>(type: "INTEGER", nullable: true),
|
|
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
|
VoteIndex = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PollVote", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_PollVote_Poll_PollId",
|
|
column: x => x.PollId,
|
|
principalTable: "Poll",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Poll_GuildId",
|
|
table: "Poll",
|
|
column: "GuildId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PollAnswer_PollId",
|
|
table: "PollAnswer",
|
|
column: "PollId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PollVote_PollId",
|
|
table: "PollVote",
|
|
column: "PollId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "PollAnswer");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PollVote");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Poll");
|
|
}
|
|
}
|
|
}
|