Browse Source

Fixes in opened_roles

Veloe 4 years ago
parent
commit
1e8fbe1659

+ 11 - 11
MafiaTelegramBot/DataBase/Entity/OpenedRolesEntity.cs

@@ -13,17 +13,17 @@ namespace MafiaTelegramBot.DataBase.Entity
         [DatabaseGenerated(DatabaseGeneratedOption.None)]
         [Column("id"), MaxLength(127)] public long Id { get; init; }
 
-        [Column("Bodyguard")] public bool Bodyguard { get; init; } = false;
-        [Column("Dame")] public bool Dame { get; init; } = false;
-        [Column("Detective")] public bool Detective { get; init; } = false;
-        [Column("Elder")] public bool Elder { get; init; } = false;
-        [Column("Fool")] public bool Fool { get; init; } = false;
-        [Column("Hooker")] public bool Hooker { get; init; } = false;
-        [Column("Journalist")] public bool Journalist { get; init; } = false;
-        [Column("Lawyer")] public bool Lawyer { get; init; } = false;
-        [Column("Necromancer")] public bool Necromancer { get; init; } = false;
-        [Column("Parasite")] public bool Parasite { get; init; } = false;
-        [Column("Werewolf")] public bool Werewolf { get; init; } = false;
+        [Column("bodyguard") , MaxLength(127)] public bool Bodyguard { get; init; }
+        [Column("dame") , MaxLength(127)] public bool Dame { get; init; }
+        [Column("detective") , MaxLength(127)] public bool Detective { get; init; }
+        [Column("elder") , MaxLength(127)] public bool Elder { get; init; }
+        [Column("fool") , MaxLength(127)] public bool Fool { get; init; }
+        [Column("hooker") , MaxLength(127)] public bool Hooker { get; init; }
+        [Column("journalist") , MaxLength(127)] public bool Journalist { get; init; }
+        [Column("lawyer") , MaxLength(127)] public bool Lawyer { get; init; }
+        [Column("necromancer") , MaxLength(127)] public bool Necromancer { get; init; }
+        [Column("parasite") , MaxLength(127)] public bool Parasite { get; init; }
+        [Column("werewolf") , MaxLength(127)] public bool Werewolf { get; init; }
         
         public List<Roles> ToList()
         {

+ 23 - 0
MafiaTelegramBot/DataBase/MafiaDataBase.cs

@@ -39,6 +39,29 @@ namespace MafiaTelegramBot.DataBase
         {
             modelBuilder.Entity<StatisticsEntity>()
                 .HasKey(s => new {s.UserId, s.Role});
+
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Bodyguard).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Dame).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Detective).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Elder).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Fool).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Hooker).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Journalist).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Lawyer).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Necromancer).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Parasite).HasDefaultValue(0);
+            modelBuilder.Entity<OpenedRolesEntity>()
+                .Property(r => r.Werewolf).HasDefaultValue(0);
         }
     }
 }