NadekoBot/src/NadekoBot/Services/Database/NadekoContext.cs

41 lines
1.1 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database
{
public abstract class NadekoContext : DbContext
{
public DbSet<Quote> Quotes { get; }
2016-08-24 13:29:01 +00:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
#region QUOTES
//// guildid and keyword are unique pair
var quoteEntity = modelBuilder.Entity<Quote>();
//quoteEntity
// .HasAlternateKey(q => q.GuildId)
// .HasName("AK_GuildId_Keyword");
//quoteEntity
// .HasAlternateKey(q => q.Keyword)
// .HasName("AK_GuildId_Keyword");
quoteEntity
.HasIndex(q => new { q.GuildId, q.Keyword })
.IsUnique();
#endregion
#region
#endregion
}
protected abstract override void OnConfiguring(DbContextOptionsBuilder optionsBuilder);
}
}