Added giveaway commands .ga start/end/cancel/reroll/list

This commit is contained in:
Kwoth
2024-04-24 22:31:45 +00:00
parent 59b9742c19
commit 49563ea6d4
16 changed files with 247 additions and 57 deletions

View File

@@ -0,0 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Db.Migrations.Sqlite
{
/// <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: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
MessageId = table.Column<ulong>(type: "INTEGER", nullable: false),
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
Message = table.Column<string>(type: "TEXT", nullable: false),
EndsAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GiveawayModel", x => x.Id);
});
migrationBuilder.CreateTable(
name: "GiveawayUser",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GiveawayId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
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);
});
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");
}
}
}