-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTutorfyDatabaseContext.cs
37 lines (32 loc) · 1.11 KB
/
TutorfyDatabaseContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using tutorfy_backend.Models;
namespace tutorfy_backend
{
public partial class TutorfyDatabaseContext : DbContext
{
public TutorfyDatabaseContext()
{
}
public TutorfyDatabaseContext(DbContextOptions<TutorfyDatabaseContext> options)
: base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
var conn = Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? "server=localhost;database=TutorfyDatabase";
optionsBuilder.UseNpgsql(conn);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{}
public DbSet<Appointment> Appointments { get; set; }
public DbSet<Student> Students { get; set; }
public DbSet<Tutor> Tutors { get; set; }
public DbSet<Quiz> Quizzes { get; set; }
public DbSet<User> Users { get; set; }
}
}