Update model database schema
This commit is contained in:
46
Elwig/Models/Season.cs
Normal file
46
Elwig/Models/Season.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("season"), PrimaryKey("Year")]
|
||||
public class Season {
|
||||
[Column("year")]
|
||||
public int Year { get; set; }
|
||||
|
||||
[Column("currency")]
|
||||
public string CurrencyCode { get; set; }
|
||||
|
||||
[Column("precision")]
|
||||
public int Precision { get; set; }
|
||||
|
||||
[Column("start_date")]
|
||||
public string? StartDateString { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateOnly? StartDate {
|
||||
get {
|
||||
return StartDateString != null ? DateOnly.ParseExact(StartDateString, "yyyy-MM-dd") : null;
|
||||
}
|
||||
set {
|
||||
StartDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
[Column("end_date")]
|
||||
public string? EndDateString { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateOnly? EndDate {
|
||||
get {
|
||||
return EndDateString != null ? DateOnly.ParseExact(EndDateString, "yyyy-MM-dd") : null;
|
||||
}
|
||||
set {
|
||||
EndDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("CurrencyCode")]
|
||||
public virtual Currency Currency { get; private set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user