Set news date as DateTime.

This commit is contained in:
2019-05-18 23:05:54 +01:00
parent b8614aca51
commit c93e29b181
6 changed files with 1946 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Cicm.Database.Migrations
{
public partial class NewsDateAsDateTime : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>("date", "news", "datetime", nullable: false,
oldClrType: typeof(string), oldType: "char(20)",
oldDefaultValueSql: "''");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>("date", "news", "char(20)", nullable: false, defaultValueSql: "''",
oldClrType: typeof(DateTime), oldType: "datetime");
}
}
}

View File

@@ -498,8 +498,7 @@ namespace Cicm.Database.Migrations
b.Property<int>("AddedId").ValueGeneratedOnAdd().HasColumnName("added_id").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
b.Property<string>("Date").IsRequired().ValueGeneratedOnAdd().HasColumnName("date")
.HasColumnType("char(20)").HasDefaultValueSql("''");
b.Property<DateTime>("Date").HasColumnName("date").HasColumnType("datetime");
b.Property<int>("Type").ValueGeneratedOnAdd().HasColumnName("type").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");

View File

@@ -28,12 +28,14 @@
// Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/
using System;
namespace Cicm.Database.Models
{
public class News
{
public int Id { get; set; }
public string Date { get; set; }
public DateTime Date { get; set; }
public NewsType Type { get; set; }
public int AddedId { get; set; }
}

View File

@@ -557,8 +557,7 @@ namespace Cicm.Database.Models
entity.Property(e => e.AddedId).HasColumnName("added_id").HasColumnType("int(11)")
.HasDefaultValueSql("'0'");
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("char(20)")
.HasDefaultValueSql("''");
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("datetime");
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
});

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.437</Version>
<Version>3.0.99.441</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>