using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using RMuseum.Models.Artifact; using RMuseum.Models.Bookmark; using RMuseum.Models.GanjoorAudio; using RMuseum.Models.UploadSession; using RMuseum.Models.GanjoorIntegration; using RMuseum.Models.ImportJob; using RMuseum.Models.Note; using RSecurityBackend.DbContext; using RSecurityBackend.Models.Auth.Db; using System; using RMuseum.Models.Ganjoor; using RMuseum.Models.MusicCatalogue; namespace RMuseum.DbContext { /// /// Museum Database Context /// public class RMuseumDbContext : RSecurityDbContext { /// /// constructor /// public RMuseumDbContext(IConfiguration configuration) { Configuration = configuration; Database.Migrate(); } /// /// /// public IConfiguration Configuration { get; } /// /// /// /// protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")); base.OnConfiguring(optionsBuilder); } /// /// /// /// protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity() .HasIndex(m => m.FriendlyUrl) .IsUnique(); builder.Entity() .HasIndex(i => new { i.RArtifactMasterRecordId, i.FriendlyUrl }) .IsUnique(); builder.Entity() .HasIndex(i => new { i.RArtifactMasterRecordId, i.Order }) .IsUnique(); builder.Entity() .HasIndex(t => t.FriendlyUrl); builder.Entity() .HasIndex(t => t.FriendlyUrl); builder.Entity() .HasIndex(p => p.GanjoorPostId); builder.Entity() .HasIndex(c => c.FullUrl); builder.Entity() .HasIndex(c => c.FullUrl); builder.Entity() .HasIndex(c => c.FullUrl); builder.Entity() .HasIndex(c => c.Name); builder.Entity() .HasIndex(c => c.Name); } /// /// Picture Files /// public DbSet PictureFiles { get; set; } /// /// Item Attributes /// public DbSet Tags { get; set; } /// /// Artifacts /// public DbSet Artifacts { get; set; } /// /// Items /// public DbSet Items { get; set; } /// /// Import Jobs /// public DbSet ImportJobs { get; set; } /// /// Tags /// public DbSet TagValues { get; set; } /// /// User Bookmarks /// public DbSet UserBookmarks { get; set; } /// /// User Notes /// public DbSet UserNotes { get; set; } /// /// Ganjoor Links /// public DbSet GanjoorLinks { get; set; } /// /// Pinterest Links /// public DbSet PinterestLinks { get; set; } /// /// Ganjoor Audio Files /// public DbSet Recitations { get; set; } /// /// Upload Sessions /// public DbSet UploadSessions { get; set; } /// /// Uploaded files /// public DbSet UploadedFiles { get; set; } /// /// User Recitation Profiles /// public DbSet UserRecitationProfiles { get; set; } /// /// Ganjoor Poets /// public DbSet GanjoorPoets { get; set; } /// /// Ganjoor Categories /// public DbSet GanjoorCategories { get; set; } /// /// Ganjoor Poems /// public DbSet GanjoorPoems { get; set; } /// /// Ganjoor Verses /// public DbSet GanjoorVerses { get; set; } /// /// Narration Publishing Tracker /// public DbSet RecitationPublishingTrackers { get; set; } /// /// Ganjoor Pages /// public DbSet GanjoorPages { get; set; } /// /// Ganjoor Metres /// public DbSet GanjoorMetres { get; set; } /// /// singers /// public DbSet GanjoorSingers { get; set; } /// /// music tracks /// public DbSet GanjoorMusicCatalogueTracks { get; set; } /// /// golha tracks /// public DbSet GolhaTracks { get; set; } /// /// GolhaCollection /// public DbSet GolhaCollections { get; set; } /// /// GolhaPrograms /// public DbSet GolhaPrograms { get; set; } /// /// PoemMusicTracks /// public DbSet GanjoorPoemMusicTracks { get; set; } /// /// Ganjoor Comments /// public DbSet GanjoorComments { get; set; } /// /// Ganjoor Reported Comments /// public DbSet GanjoorReportedComments { get; set; } /// /// Ganjoor Page Snapshots /// public DbSet GanjoorPageSnapshots { get; set; } /// /// Ganjoor Site Bannaers /// public DbSet GanjoorSiteBanners { get; set; } /// /// Ganjoor Health Check Errors /// public DbSet GanjoorHealthCheckErrors { get; set; } } }