Adds role specific channels.

This commit is contained in:
Karolis2011
2019-06-20 11:19:39 +03:00
parent 8058bffba5
commit b74c666d05
13 changed files with 555 additions and 18 deletions

View File

@@ -0,0 +1,147 @@
// <auto-generated />
using System;
using EventBot.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EventBot.Migrations.MySql
{
[DbContext(typeof(MySqlDatabaseService))]
[Migration("20190620075923_AutoRolesAndChannels")]
partial class AutoRolesAndChannels
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("EventBot.Entities.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<string>("Description");
b.Property<ulong>("GuildId");
b.Property<ulong>("MessageChannelId");
b.Property<ulong>("MessageId");
b.Property<DateTime>("Opened");
b.Property<string>("Title");
b.Property<int>("Type");
b.HasKey("Id");
b.HasIndex("GuildId");
b.ToTable("Events");
});
modelBuilder.Entity("EventBot.Entities.EventParticipant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("EventId");
b.Property<int>("EventRoleId");
b.Property<string>("UserData");
b.Property<ulong>("UserId");
b.HasKey("Id");
b.HasIndex("EventId");
b.HasIndex("EventRoleId");
b.ToTable("EventParticipants");
});
modelBuilder.Entity("EventBot.Entities.EventRole", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<ulong>("ChannelId");
b.Property<string>("Description");
b.Property<string>("Emote");
b.Property<int>("EventId");
b.Property<int>("MaxParticipants");
b.Property<ulong>("RoleId");
b.Property<string>("Title");
b.HasKey("Id");
b.HasIndex("EventId");
b.ToTable("EventRoles");
});
modelBuilder.Entity("EventBot.Entities.GuildConfig", b =>
{
b.Property<ulong>("GuildId")
.ValueGeneratedOnAdd();
b.Property<ulong>("AutoRoleChannelCategoryId");
b.Property<ulong>("EventRoleConfirmationChannelId");
b.Property<ulong>("ParticipantRoleId");
b.Property<string>("Prefix");
b.HasKey("GuildId");
b.ToTable("GuildConfigs");
});
modelBuilder.Entity("EventBot.Entities.Event", b =>
{
b.HasOne("EventBot.Entities.GuildConfig", "Guild")
.WithMany("Events")
.HasForeignKey("GuildId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("EventBot.Entities.EventParticipant", b =>
{
b.HasOne("EventBot.Entities.Event", "Event")
.WithMany("Participants")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EventBot.Entities.EventRole", "Role")
.WithMany("Participants")
.HasForeignKey("EventRoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("EventBot.Entities.EventRole", b =>
{
b.HasOne("EventBot.Entities.Event", "Event")
.WithMany("Roles")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EventBot.Migrations.MySql
{
public partial class AutoRolesAndChannels : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<ulong>(
name: "AutoRoleChannelCategoryId",
table: "GuildConfigs",
nullable: false,
defaultValue: 0ul);
migrationBuilder.AddColumn<ulong>(
name: "ChannelId",
table: "EventRoles",
nullable: false,
defaultValue: 0ul);
migrationBuilder.AddColumn<ulong>(
name: "RoleId",
table: "EventRoles",
nullable: false,
defaultValue: 0ul);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AutoRoleChannelCategoryId",
table: "GuildConfigs");
migrationBuilder.DropColumn(
name: "ChannelId",
table: "EventRoles");
migrationBuilder.DropColumn(
name: "RoleId",
table: "EventRoles");
}
}
}

View File

@@ -72,6 +72,8 @@ namespace EventBot.Migrations.MySql
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<ulong>("ChannelId");
b.Property<string>("Description");
b.Property<string>("Emote");
@@ -80,6 +82,8 @@ namespace EventBot.Migrations.MySql
b.Property<int>("MaxParticipants");
b.Property<ulong>("RoleId");
b.Property<string>("Title");
b.HasKey("Id");
@@ -94,6 +98,8 @@ namespace EventBot.Migrations.MySql
b.Property<ulong>("GuildId")
.ValueGeneratedOnAdd();
b.Property<ulong>("AutoRoleChannelCategoryId");
b.Property<ulong>("EventRoleConfirmationChannelId");
b.Property<ulong>("ParticipantRoleId");

View File

@@ -0,0 +1,146 @@
// <auto-generated />
using System;
using EventBot.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EventBot.Migrations.Sqlite
{
[DbContext(typeof(SqliteDatabaseService))]
[Migration("20190620080021_AutoRolesAndChannels")]
partial class AutoRolesAndChannels
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity("EventBot.Entities.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Active");
b.Property<string>("Description");
b.Property<ulong>("GuildId");
b.Property<ulong>("MessageChannelId");
b.Property<ulong>("MessageId");
b.Property<DateTime>("Opened");
b.Property<string>("Title");
b.Property<int>("Type");
b.HasKey("Id");
b.HasIndex("GuildId");
b.ToTable("Events");
});
modelBuilder.Entity("EventBot.Entities.EventParticipant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("EventId");
b.Property<int>("EventRoleId");
b.Property<string>("UserData");
b.Property<ulong>("UserId");
b.HasKey("Id");
b.HasIndex("EventId");
b.HasIndex("EventRoleId");
b.ToTable("EventParticipants");
});
modelBuilder.Entity("EventBot.Entities.EventRole", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<ulong>("ChannelId");
b.Property<string>("Description");
b.Property<string>("Emote");
b.Property<int>("EventId");
b.Property<int>("MaxParticipants");
b.Property<ulong>("RoleId");
b.Property<string>("Title");
b.HasKey("Id");
b.HasIndex("EventId");
b.ToTable("EventRoles");
});
modelBuilder.Entity("EventBot.Entities.GuildConfig", b =>
{
b.Property<ulong>("GuildId")
.ValueGeneratedOnAdd();
b.Property<ulong>("AutoRoleChannelCategoryId");
b.Property<ulong>("EventRoleConfirmationChannelId");
b.Property<ulong>("ParticipantRoleId");
b.Property<string>("Prefix");
b.HasKey("GuildId");
b.ToTable("GuildConfigs");
});
modelBuilder.Entity("EventBot.Entities.Event", b =>
{
b.HasOne("EventBot.Entities.GuildConfig", "Guild")
.WithMany("Events")
.HasForeignKey("GuildId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("EventBot.Entities.EventParticipant", b =>
{
b.HasOne("EventBot.Entities.Event", "Event")
.WithMany("Participants")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EventBot.Entities.EventRole", "Role")
.WithMany("Participants")
.HasForeignKey("EventRoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("EventBot.Entities.EventRole", b =>
{
b.HasOne("EventBot.Entities.Event", "Event")
.WithMany("Roles")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EventBot.Migrations.Sqlite
{
public partial class AutoRolesAndChannels : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<ulong>(
name: "AutoRoleChannelCategoryId",
table: "GuildConfigs",
nullable: false,
defaultValue: 0ul);
migrationBuilder.AddColumn<ulong>(
name: "ChannelId",
table: "EventRoles",
nullable: false,
defaultValue: 0ul);
migrationBuilder.AddColumn<ulong>(
name: "RoleId",
table: "EventRoles",
nullable: false,
defaultValue: 0ul);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AutoRoleChannelCategoryId",
table: "GuildConfigs");
migrationBuilder.DropColumn(
name: "ChannelId",
table: "EventRoles");
migrationBuilder.DropColumn(
name: "RoleId",
table: "EventRoles");
}
}
}

View File

@@ -71,6 +71,8 @@ namespace EventBot.Migrations.Sqlite
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<ulong>("ChannelId");
b.Property<string>("Description");
b.Property<string>("Emote");
@@ -79,6 +81,8 @@ namespace EventBot.Migrations.Sqlite
b.Property<int>("MaxParticipants");
b.Property<ulong>("RoleId");
b.Property<string>("Title");
b.HasKey("Id");
@@ -93,6 +97,8 @@ namespace EventBot.Migrations.Sqlite
b.Property<ulong>("GuildId")
.ValueGeneratedOnAdd();
b.Property<ulong>("AutoRoleChannelCategoryId");
b.Property<ulong>("EventRoleConfirmationChannelId");
b.Property<ulong>("ParticipantRoleId");