AccessLevel migrations are working
This commit is contained in:
@@ -1,14 +1,12 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
using Icarus.Models;
|
|
||||||
|
|
||||||
namespace Icarus.Database.Contexts;
|
namespace Icarus.Database.Contexts;
|
||||||
|
|
||||||
|
|
||||||
public class AccessLevelContext : DbContext
|
public class AccessLevelContext : DbContext
|
||||||
{
|
{
|
||||||
public DbSet<AccessLevel> AccessLevels { get; set; }
|
public DbSet<Icarus.Models.AccessLevel>? AccessLevels { get; set; }
|
||||||
|
|
||||||
|
public AccessLevelContext(DbContextOptions<AccessLevelContext> options) : base(options) { }
|
||||||
public AccessLevelContext(string connString) : base(new DbContextOptionsBuilder<AccessLevelContext>()
|
public AccessLevelContext(string connString) : base(new DbContextOptionsBuilder<AccessLevelContext>()
|
||||||
.UseMySQL(connString).Options)
|
.UseMySQL(connString).Options)
|
||||||
{
|
{
|
||||||
@@ -18,6 +16,9 @@ public class AccessLevelContext : DbContext
|
|||||||
#region Methods
|
#region Methods
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
modelBuilder.Entity<Icarus.Models.AccessLevel>().ToTable("AccessLevel");
|
||||||
|
|
||||||
|
// modelBuilder.Entity<Icarus.Models.AccessLevel>().Property(m => m.Level).IsRequired(true);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,7 @@ builder.Services.AddDbContext<ArtistContext>(options => options.UseMySQL(connStr
|
|||||||
builder.Services.AddDbContext<UserContext>(options => options.UseMySQL(connString!));
|
builder.Services.AddDbContext<UserContext>(options => options.UseMySQL(connString!));
|
||||||
builder.Services.AddDbContext<GenreContext>(options => options.UseMySQL(connString!));
|
builder.Services.AddDbContext<GenreContext>(options => options.UseMySQL(connString!));
|
||||||
builder.Services.AddDbContext<CoverArtContext>(options => options.UseMySQL(connString!));
|
builder.Services.AddDbContext<CoverArtContext>(options => options.UseMySQL(connString!));
|
||||||
|
builder.Services.AddDbContext<AccessLevelContext>(options => options.UseMySQL(connString!));
|
||||||
|
|
||||||
builder.Services.AddControllers()
|
builder.Services.AddControllers()
|
||||||
.AddNewtonsoftJson();
|
.AddNewtonsoftJson();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class AccessLevel
|
|||||||
[Newtonsoft.Json.JsonProperty("id")]
|
[Newtonsoft.Json.JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Newtonsoft.Json.JsonProperty("level")]
|
[Newtonsoft.Json.JsonProperty("level")]
|
||||||
public string Level { get; set; }
|
public string? Level { get; set; }
|
||||||
[Newtonsoft.Json.JsonProperty("song_id")]
|
[Newtonsoft.Json.JsonProperty("song_id")]
|
||||||
public int SongId { get; set; }
|
public int SongId { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user