Initial Commit
Inital Commit of Code base, nothing tested.
This commit is contained in:
commit
0144221712
31 changed files with 1304 additions and 0 deletions
37
FreeTubeSync/Database/DataContext.cs
Normal file
37
FreeTubeSync/Database/DataContext.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using FreeTubeSync.Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FreeTubeSync.Database;
|
||||
|
||||
public class DataContext : DbContext
|
||||
{
|
||||
public DataContext(DbContextOptions<DataContext> options) : base(options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite("Data Source=FreeTubeSync.db");
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Setting>()
|
||||
.ToTable("Settings")
|
||||
.HasKey(s => s._id);
|
||||
|
||||
modelBuilder.Entity<Setting>()
|
||||
.Property(s => s.ValueJson)
|
||||
.HasColumnName("Value")
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
public DbSet<History> Histories { get; set; }
|
||||
public DbSet<Playlist> Playlists { get; set; }
|
||||
public DbSet<Profile> Profiles { get; set; }
|
||||
public DbSet<SearchHistory> SearchHistories { get; set; }
|
||||
public DbSet<Setting> Settings { get; set; }
|
||||
public DbSet<Subscription> Subscriptions { get; set; }
|
||||
public DbSet<Video> Videos { get; set; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue