2016-08-24 01:32:48 +00:00
|
|
|
|
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
|
|
|
|
|
}
|
2016-08-24 01:32:48 +00:00
|
|
|
|
protected abstract override void OnConfiguring(DbContextOptionsBuilder optionsBuilder);
|
|
|
|
|
}
|
|
|
|
|
}
|