diff --git a/src/NadekoBot/Migrations/20160829215759_first.Designer.cs b/src/NadekoBot/Migrations/20160830011641_first.Designer.cs similarity index 95% rename from src/NadekoBot/Migrations/20160829215759_first.Designer.cs rename to src/NadekoBot/Migrations/20160830011641_first.Designer.cs index f15cb84e..a1c78a53 100644 --- a/src/NadekoBot/Migrations/20160829215759_first.Designer.cs +++ b/src/NadekoBot/Migrations/20160830011641_first.Designer.cs @@ -8,7 +8,7 @@ using NadekoBot.Services.Database.Impl; namespace NadekoBot.Migrations { [DbContext(typeof(NadekoSqliteContext))] - [Migration("20160829215759_first")] + [Migration("20160830011641_first")] partial class first { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -104,6 +104,23 @@ namespace NadekoBot.Migrations b.ToTable("ClashOfClans"); }); + modelBuilder.Entity("NadekoBot.Services.Database.Models.Currency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Currency"); + }); + modelBuilder.Entity("NadekoBot.Services.Database.Models.Donator", b => { b.Property("Id") @@ -160,6 +177,8 @@ namespace NadekoBot.Migrations b.Property("ChannelGreetMessageText"); + b.Property("DefaultMusicVolume"); + b.Property("DeleteMessageOnCommand"); b.Property("DmGreetMessageText"); diff --git a/src/NadekoBot/Migrations/20160829215759_first.cs b/src/NadekoBot/Migrations/20160830011641_first.cs similarity index 94% rename from src/NadekoBot/Migrations/20160829215759_first.cs rename to src/NadekoBot/Migrations/20160830011641_first.cs index ca6ea305..cf8464d4 100644 --- a/src/NadekoBot/Migrations/20160829215759_first.cs +++ b/src/NadekoBot/Migrations/20160830011641_first.cs @@ -47,6 +47,20 @@ namespace NadekoBot.Migrations table.PrimaryKey("PK_ClashOfClans", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Currency", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Autoincrement", true), + Amount = table.Column(nullable: false), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Currency", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Donators", columns: table => new @@ -76,6 +90,7 @@ namespace NadekoBot.Migrations ByeMessageChannelId = table.Column(nullable: false), ChannelByeMessageText = table.Column(nullable: true), ChannelGreetMessageText = table.Column(nullable: true), + DefaultMusicVolume = table.Column(nullable: false), DeleteMessageOnCommand = table.Column(nullable: false), DmGreetMessageText = table.Column(nullable: true), ExclusiveSelfAssignedRoles = table.Column(nullable: false), @@ -290,6 +305,12 @@ namespace NadekoBot.Migrations table: "ClashCallers", column: "ClashWarId"); + migrationBuilder.CreateIndex( + name: "IX_Currency_UserId", + table: "Currency", + column: "UserId", + unique: true); + migrationBuilder.CreateIndex( name: "IX_Donators_UserId", table: "Donators", @@ -343,6 +364,9 @@ namespace NadekoBot.Migrations migrationBuilder.DropTable( name: "ClashCallers"); + migrationBuilder.DropTable( + name: "Currency"); + migrationBuilder.DropTable( name: "Donators"); diff --git a/src/NadekoBot/Migrations/NadekoSqliteContextModelSnapshot.cs b/src/NadekoBot/Migrations/NadekoSqliteContextModelSnapshot.cs index 0ab69283..456411fc 100644 --- a/src/NadekoBot/Migrations/NadekoSqliteContextModelSnapshot.cs +++ b/src/NadekoBot/Migrations/NadekoSqliteContextModelSnapshot.cs @@ -103,6 +103,23 @@ namespace NadekoBot.Migrations b.ToTable("ClashOfClans"); }); + modelBuilder.Entity("NadekoBot.Services.Database.Models.Currency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Currency"); + }); + modelBuilder.Entity("NadekoBot.Services.Database.Models.Donator", b => { b.Property("Id") @@ -159,6 +176,8 @@ namespace NadekoBot.Migrations b.Property("ChannelGreetMessageText"); + b.Property("DefaultMusicVolume"); + b.Property("DeleteMessageOnCommand"); b.Property("DmGreetMessageText"); diff --git a/src/NadekoBot/Services/Database/NadekoContext.cs b/src/NadekoBot/Services/Database/NadekoContext.cs index a8e9ae39..ae32be4a 100644 --- a/src/NadekoBot/Services/Database/NadekoContext.cs +++ b/src/NadekoBot/Services/Database/NadekoContext.cs @@ -19,6 +19,7 @@ namespace NadekoBot.Services.Database public DbSet SelfAssignableRoles { get; set; } public DbSet BotConfig { get; set; } public DbSet Repeaters { get; set; } + public DbSet Currency { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { @@ -74,6 +75,14 @@ namespace NadekoBot.Services.Database .IsUnique(); #endregion + + #region Currency + var currencyEntity = modelBuilder.Entity(); + + currencyEntity + .HasIndex(c => c.UserId) + .IsUnique(); + #endregion } protected abstract override void OnConfiguring(DbContextOptionsBuilder optionsBuilder); }