added napiszar, using MsEntitiFramework, addreactionrole command working just with link
This commit is contained in:
parent
1695770f9f
commit
d508bffac1
9 changed files with 318 additions and 94 deletions
40
helpers/dbcontext.cs
Normal file
40
helpers/dbcontext.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using T3k3rg0.Helpers.Models;
|
||||
|
||||
namespace T3k3rg0.Helpers.Data
|
||||
{
|
||||
public static class DbPaths
|
||||
{
|
||||
public static readonly string napiszarDbPath = Environment.GetEnvironmentVariable("DB_NAPISZAR_LOC");
|
||||
public static readonly string rolesDbPath = Environment.GetEnvironmentVariable("DB_ROLES_LOC");
|
||||
}
|
||||
|
||||
public class NapiszarDbContext : DbContext
|
||||
{
|
||||
public DbSet<Joslat> Joslatok { get; set; }
|
||||
public DbSet<DailyUsage> DailyUsages { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite($"Data Source={DbPaths.napiszarDbPath}");
|
||||
}
|
||||
}
|
||||
|
||||
public class RolesDbContext : DbContext
|
||||
{
|
||||
public DbSet<ReactionRole> ReactionRoles { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<ReactionRole>()
|
||||
.HasKey(r => new { r.MessageId, r.Emoji });
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite($"Data Source={DbPaths.rolesDbPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue