Existing ASP.NET API with vanilla JS SPA, WindowWatcher, Chrome extension, and MCP server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
141 lines
6.2 KiB
C#
141 lines
6.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace TaskTracker.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AppMappings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Pattern = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
|
MatchType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
Category = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
FriendlyName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AppMappings", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Tasks",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Title = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
Category = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
StartedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CompletedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Tasks", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ContextEvents",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
WorkTaskId = table.Column<int>(type: "int", nullable: true),
|
|
Source = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
AppName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
|
WindowTitle = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
|
|
Url = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
|
|
Timestamp = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ContextEvents", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ContextEvents_Tasks_WorkTaskId",
|
|
column: x => x.WorkTaskId,
|
|
principalTable: "Tasks",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Notes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
WorkTaskId = table.Column<int>(type: "int", nullable: false),
|
|
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notes", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Notes_Tasks_WorkTaskId",
|
|
column: x => x.WorkTaskId,
|
|
principalTable: "Tasks",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "AppMappings",
|
|
columns: new[] { "Id", "Category", "FriendlyName", "MatchType", "Pattern" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Engineering", "SolidWorks", "ProcessName", "SLDWORKS" },
|
|
{ 2, "Email", "Outlook", "ProcessName", "OUTLOOK" },
|
|
{ 3, "General", "Notepad", "ProcessName", "notepad" },
|
|
{ 4, "LaserCutting", "PEP System", "UrlContains", "pep" },
|
|
{ 5, "Engineering", "SolidWorks", "TitleContains", "solidworks" }
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ContextEvents_Timestamp",
|
|
table: "ContextEvents",
|
|
column: "Timestamp");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ContextEvents_WorkTaskId",
|
|
table: "ContextEvents",
|
|
column: "WorkTaskId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notes_WorkTaskId",
|
|
table: "Notes",
|
|
column: "WorkTaskId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AppMappings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ContextEvents");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Notes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Tasks");
|
|
}
|
|
}
|
|
}
|