Polls persist restarts now.
This commit is contained in:
1992
NadekoBot.Core/Migrations/20171027155001_poll-rewrite.Designer.cs
generated
Normal file
1992
NadekoBot.Core/Migrations/20171027155001_poll-rewrite.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
100
NadekoBot.Core/Migrations/20171027155001_poll-rewrite.cs
Normal file
100
NadekoBot.Core/Migrations/20171027155001_poll-rewrite.cs
Normal file
@ -0,0 +1,100 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -983,6 +983,67 @@ namespace NadekoBot.Migrations
|
||||
b.ToTable("PlaylistSong");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.Poll", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<ulong>("ChannelId");
|
||||
|
||||
b.Property<DateTime?>("DateAdded");
|
||||
|
||||
b.Property<ulong>("GuildId");
|
||||
|
||||
b.Property<string>("Question");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuildId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Poll");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.PollAnswer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime?>("DateAdded");
|
||||
|
||||
b.Property<int>("Index");
|
||||
|
||||
b.Property<int?>("PollId");
|
||||
|
||||
b.Property<string>("Text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PollId");
|
||||
|
||||
b.ToTable("PollAnswer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.PollVote", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime?>("DateAdded");
|
||||
|
||||
b.Property<int?>("PollId");
|
||||
|
||||
b.Property<ulong>("UserId");
|
||||
|
||||
b.Property<int>("VoteIndex");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PollId");
|
||||
|
||||
b.ToTable("PollVote");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.Quote", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -1771,6 +1832,20 @@ namespace NadekoBot.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.PollAnswer", b =>
|
||||
{
|
||||
b.HasOne("NadekoBot.Core.Services.Database.Models.Poll")
|
||||
.WithMany("Answers")
|
||||
.HasForeignKey("PollId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.PollVote", b =>
|
||||
{
|
||||
b.HasOne("NadekoBot.Core.Services.Database.Models.Poll")
|
||||
.WithMany("Votes")
|
||||
.HasForeignKey("PollId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Core.Services.Database.Models.RaceAnimal", b =>
|
||||
{
|
||||
b.HasOne("NadekoBot.Core.Services.Database.Models.BotConfig")
|
||||
|
Reference in New Issue
Block a user