Skip to content

Commit

Permalink
add 'ScreenshotsDir' to ReleaseModel
Browse files Browse the repository at this point in the history
  • Loading branch information
d2phap committed Jun 26, 2023
1 parent a8d6b20 commit 40153a6
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 58 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# website
# website

### Create a migration
See: https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli
```
dotnet ef migrations add InitialCreate
```

### Create dataset
```
dotnet ef database update
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

namespace ImageGlass.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
Expand All @@ -15,8 +17,6 @@ protected override void Up(MigrationBuilder migrationBuilder)
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true),
Image = table.Column<string>(type: "text", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(type: "text", nullable: true),
Expand All @@ -27,7 +27,9 @@ protected override void Up(MigrationBuilder migrationBuilder)
Count = table.Column<int>(type: "INTEGER", nullable: false),
IsVisible = table.Column<bool>(type: "INTEGER", nullable: false),
CreatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false)
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
Expand All @@ -40,14 +42,14 @@ protected override void Up(MigrationBuilder migrationBuilder)
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Slug = table.Column<string>(type: "text", nullable: false),
Title = table.Column<string>(type: "text", nullable: true),
Image = table.Column<string>(type: "text", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
CustomContentUrl = table.Column<string>(type: "TEXT", nullable: true),
IsVisible = table.Column<bool>(type: "INTEGER", nullable: false),
CreatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false)
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
Expand Down Expand Up @@ -76,8 +78,6 @@ protected override void Up(MigrationBuilder migrationBuilder)
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true),
Image = table.Column<string>(type: "text", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
IsDarkMode = table.Column<bool>(type: "INTEGER", nullable: false),
Expand All @@ -90,7 +90,9 @@ protected override void Up(MigrationBuilder migrationBuilder)
Count = table.Column<int>(type: "INTEGER", nullable: false),
IsVisible = table.Column<bool>(type: "INTEGER", nullable: false),
CreatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false)
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
Expand All @@ -103,16 +105,17 @@ protected override void Up(MigrationBuilder migrationBuilder)
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true),
Image = table.Column<string>(type: "text", nullable: true),
ReleaseChannel = table.Column<string>(type: "text", nullable: true),
Version = table.Column<string>(type: "text", nullable: true),
ScreenshotsDir = table.Column<string>(type: "text", nullable: true),
NewsId = table.Column<int>(type: "INTEGER", nullable: true),
RequirementId = table.Column<int>(type: "INTEGER", nullable: false),
IsVisible = table.Column<bool>(type: "INTEGER", nullable: false),
CreatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false)
UpdatedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Slug = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
Expand Down Expand Up @@ -165,6 +168,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
column: "RequirementId");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
Expand Down
6 changes: 4 additions & 2 deletions Source/Website/Migrations/ImageGlassContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ partial class ImageGlassContextModelSnapshot : ModelSnapshot
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
modelBuilder.HasAnnotation("ProductVersion", "7.0.7");

modelBuilder.Entity("ImageGlass.Models.BinaryFileModel", b =>
{
Expand Down Expand Up @@ -138,7 +138,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("INTEGER");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Title")
Expand Down Expand Up @@ -176,6 +175,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<int>("RequirementId")
.HasColumnType("INTEGER");
b.Property<string>("ScreenshotsDir")
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("text");
Expand Down
1 change: 0 additions & 1 deletion Source/Website/Models/NewsModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable disable
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.ComponentModel.DataAnnotations.Schema;

Expand Down
12 changes: 11 additions & 1 deletion Source/Website/Models/ReleaseModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;
Expand All @@ -19,6 +19,15 @@ public class ReleaseModel : ArticleBaseModel
public string Version { get; set; } = string.Empty;


/// <summary>
/// Folder name of screenshots.
/// E.g. <c>v9.0-beta-4</c>
/// from <c>releases/screenshots/v9.0-beta-4</c>
/// </summary>
[Column(TypeName = "text")]
public string ScreenshotsDir { get; set; } = string.Empty;


[AllowNull]
public int? NewsId { get; set; }

Expand Down Expand Up @@ -60,6 +69,7 @@ public ReleaseDetailModel(ReleaseModel model, bool preview = false)
Image = model.Image;
ReleaseChannel = model.ReleaseChannel;
Version = model.Version;
ScreenshotsDir = model.ScreenshotsDir;
NewsId = model.NewsId;
IsVisible = model.IsVisible;
CreatedDate = model.CreatedDate;
Expand Down
Loading

0 comments on commit 40153a6

Please sign in to comment.