8b0451c2ec
This commit enhances the Note entity by introducing two new properties: IsPinned and IsDeleted, allowing for better management of note visibility and status. The NoteConfiguration class has been updated to include indexes for these properties, improving query performance. Additionally, new migrations have been created to reflect these changes in the database schema. The UI components have been updated to support pinning and restoring notes, enhancing user interaction and functionality within the note management system.
105 lines
4.1 KiB
C#
105 lines
4.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddNoteIsPinnedAndIsDeleted : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Notes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Title = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
|
Content = table.Column<string>(type: "TEXT", nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
|
LastModifiedBy = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
|
IsPinned = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notes", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "NoteHistories",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
NoteId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Title = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
|
Content = table.Column<string>(type: "TEXT", nullable: true),
|
|
ModifiedBy = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
|
ModifiedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
ChangeType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_NoteHistories", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_NoteHistories_Notes_NoteId",
|
|
column: x => x.NoteId,
|
|
principalTable: "Notes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_NoteHistories_ModifiedAt",
|
|
table: "NoteHistories",
|
|
column: "ModifiedAt");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_NoteHistories_NoteId",
|
|
table: "NoteHistories",
|
|
column: "NoteId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_NoteHistories_NoteId_ModifiedAt",
|
|
table: "NoteHistories",
|
|
columns: new[] { "NoteId", "ModifiedAt" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notes_CreatedAt",
|
|
table: "Notes",
|
|
column: "CreatedAt");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notes_IsDeleted",
|
|
table: "Notes",
|
|
column: "IsDeleted");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notes_IsPinned",
|
|
table: "Notes",
|
|
column: "IsPinned");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notes_Title",
|
|
table: "Notes",
|
|
column: "Title");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "NoteHistories");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Notes");
|
|
}
|
|
}
|
|
}
|