Started work on giveaways, not completed

This commit is contained in:
Kwoth
2024-04-24 16:31:51 +00:00
parent 08d8da25cd
commit 59b9742c19
25 changed files with 11667 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,73 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Db.Migrations.Mysql
{
/// <inheritdoc />
public partial class giveaway : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "giveawaymodel",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
guildid = table.Column<ulong>(type: "bigint unsigned", nullable: false),
messageid = table.Column<ulong>(type: "bigint unsigned", nullable: false),
message = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
endsat = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_giveawaymodel", x => x.id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "giveawayuser",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
giveawayid = table.Column<int>(type: "int", nullable: false),
userid = table.Column<ulong>(type: "bigint unsigned", nullable: false),
name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("pk_giveawayuser", x => x.id);
table.ForeignKey(
name: "fk_giveawayuser_giveawaymodel_giveawayid",
column: x => x.giveawayid,
principalTable: "giveawaymodel",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "ix_giveawayuser_giveawayid_userid",
table: "giveawayuser",
columns: new[] { "giveawayid", "userid" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "giveawayuser");
migrationBuilder.DropTable(
name: "giveawaymodel");
}
}
}

View File

@@ -3073,6 +3073,70 @@ namespace NadekoBot.Db.Migrations.Mysql
b.ToTable("followedstream", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.GiveawayModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("EndsAt")
.HasColumnType("datetime(6)")
.HasColumnName("endsat");
b.Property<ulong>("GuildId")
.HasColumnType("bigint unsigned")
.HasColumnName("guildid");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("message");
b.Property<ulong>("MessageId")
.HasColumnType("bigint unsigned")
.HasColumnName("messageid");
b.HasKey("Id")
.HasName("pk_giveawaymodel");
b.ToTable("giveawaymodel", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.GiveawayUser", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("GiveawayId")
.HasColumnType("int")
.HasColumnName("giveawayid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("name");
b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned")
.HasColumnName("userid");
b.HasKey("Id")
.HasName("pk_giveawayuser");
b.HasIndex("GiveawayId", "UserId")
.IsUnique()
.HasDatabaseName("ix_giveawayuser_giveawayid_userid");
b.ToTable("giveawayuser", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.PatronQuota", b =>
{
b.Property<ulong>("UserId")
@@ -3703,6 +3767,16 @@ namespace NadekoBot.Db.Migrations.Mysql
.HasConstraintName("fk_followedstream_guildconfigs_guildconfigid");
});
modelBuilder.Entity("NadekoBot.Db.Models.GiveawayUser", b =>
{
b.HasOne("NadekoBot.Db.Models.GiveawayModel", null)
.WithMany("Participants")
.HasForeignKey("GiveawayId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_giveawayuser_giveawaymodel_giveawayid");
});
modelBuilder.Entity("Nadeko.Bot.Db.Models.AntiSpamSetting", b =>
{
b.Navigation("IgnoredChannels");
@@ -3819,6 +3893,11 @@ namespace NadekoBot.Db.Migrations.Mysql
b.Navigation("Members");
});
modelBuilder.Entity("NadekoBot.Db.Models.GiveawayModel", b =>
{
b.Navigation("Participants");
});
#pragma warning restore 612, 618
}
}