tsk-76: Added model and context for AccessLevel
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
using Icarus.Models;
|
||||||
|
|
||||||
|
namespace Icarus.Database.Contexts;
|
||||||
|
|
||||||
|
|
||||||
|
public class AccessLevelContext : DbContext {
|
||||||
|
public DbSet<AccessLevel> AccessLevels { get; set; }
|
||||||
|
|
||||||
|
public AccessLevelContext(string connString) : base(new DbContextOptionsBuilder<AccessLevelContext>()
|
||||||
|
.UseMySQL(connString).Options)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Icarus.Models;
|
||||||
|
|
||||||
|
public class AccessLevel {
|
||||||
|
#region Properties
|
||||||
|
[Newtonsoft.Json.JsonProperty("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[Newtonsoft.Json.JsonProperty("level")]
|
||||||
|
public string Level { get; set; }
|
||||||
|
[Newtonsoft.Json.JsonProperty("song_id")]
|
||||||
|
public int SongId { get; set; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@ echo "Adding Cover art migration"
|
|||||||
dotnet dotnet-ef migrations add CoverArt --context CoverArtContext
|
dotnet dotnet-ef migrations add CoverArt --context CoverArtContext
|
||||||
echo "Adding Song migration"
|
echo "Adding Song migration"
|
||||||
dotnet dotnet-ef migrations add Song --context SongContext
|
dotnet dotnet-ef migrations add Song --context SongContext
|
||||||
|
echo "Adding AccessLevel migration"
|
||||||
|
dotnet dotnet-ef migrations add AccessLevel --context AccessLevelContext
|
||||||
|
|
||||||
echo "Updating migrations.."
|
echo "Updating migrations.."
|
||||||
echo "Updating User migration"
|
echo "Updating User migration"
|
||||||
@@ -26,4 +28,6 @@ echo "Updating Cover art migration"
|
|||||||
dotnet dotnet-ef database update --context CoverArtContext
|
dotnet dotnet-ef database update --context CoverArtContext
|
||||||
echo "Updating Song migration"
|
echo "Updating Song migration"
|
||||||
dotnet dotnet-ef database update --context SongContext
|
dotnet dotnet-ef database update --context SongContext
|
||||||
|
echo "Updating AccessLevel migration"
|
||||||
|
dotnet dotnet-ef database update --context AccessLevelContext
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user