Add missing EF migration for hufilter URL updates and enhance copilot instructions

Co-authored-by: collinbarrett <6483057+collinbarrett@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-07-29 02:49:13 +00:00 committed by Collin Barrett
parent c738a56573
commit e31b496f73
4 changed files with 88034 additions and 4 deletions

View file

@ -73,9 +73,11 @@ npm start
1. Edit JSON files in `services/Directory/data/`
2. Run `./lint.sh` to sort/format JSON consistently
3. Generate migration: `dotnet ef migrations add <Name> -p FilterLists.Directory.Infrastructure.Migrations -s FilterLists.Directory.Api`
3. **⚠️ ALWAYS REQUIRED**: Generate migration: `dotnet ef migrations add <Name> -p FilterLists.Directory.Infrastructure.Migrations -s FilterLists.Directory.Api`
4. Migration auto-applies on startup via `MigrationService`
**Note**: EF Core migrations are REQUIRED for ALL data changes. The database schema is managed by migrations, not by the JSON files alone. Forgetting this step will result in data inconsistencies between the JSON seed data and the database.
### Adding EF Migrations
Always run from `services/Directory/` with these specific parameters:
@ -119,7 +121,7 @@ When assigned to GitHub Issues requesting data updates, follow this comprehensiv
1. **JSON Updates**: Modify relevant files in `services/Directory/data/`
2. **Relationship Mapping**: Update junction tables (FilterListMaintainer, FilterListTag, etc.)
3. **Data Validation**: Ensure unique names (title case), valid relationships
4. **Migration Generation**: Follow standard EF migration process
4. **⚠️ REQUIRED: EF Migration Generation**: After ANY data changes, always generate an EF Core migration to capture the changes in the database schema
5. **Testing**: Verify changes don't break existing functionality
### Quality Standards

View file

@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FilterLists.Directory.Infrastructure.Migrations.Migrations
{
/// <inheritdoc />
public partial class UpdateHufilterUrlsToJsDelivr : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "FilterListViewUrl",
keyColumns: new[] { "FilterListId", "Id" },
keyValues: new object[] { 72, 96 },
column: "Url",
value: "https://cdn.jsdelivr.net/gh/hufilter/hufilter@gh-pages/hufilter.txt");
migrationBuilder.UpdateData(
table: "FilterListViewUrl",
keyColumns: new[] { "FilterListId", "Id" },
keyValues: new object[] { 2392, 2570 },
column: "Url",
value: "https://cdn.jsdelivr.net/gh/hufilter/hufilter@gh-pages/hufilter-dns.txt");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "FilterListViewUrl",
keyColumns: new[] { "FilterListId", "Id" },
keyValues: new object[] { 72, 96 },
column: "Url",
value: "https://raw.githubusercontent.com/hufilter/hufilter/master/hufilter.txt");
migrationBuilder.UpdateData(
table: "FilterListViewUrl",
keyColumns: new[] { "FilterListId", "Id" },
keyValues: new object[] { 2392, 2570 },
column: "Url",
value: "https://raw.githubusercontent.com/hufilter/hufilter/master/hufilter-dns.txt");
}
}
}

View file

@ -66121,7 +66121,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
Id = 96,
Primariness = (short)1,
SegmentNumber = (short)0,
Url = "https://raw.githubusercontent.com/hufilter/hufilter/master/hufilter.txt"
Url = "https://cdn.jsdelivr.net/gh/hufilter/hufilter@gh-pages/hufilter.txt"
},
new
{
@ -83937,7 +83937,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
Id = 2570,
Primariness = (short)1,
SegmentNumber = (short)0,
Url = "https://raw.githubusercontent.com/hufilter/hufilter/master/hufilter-dns.txt"
Url = "https://cdn.jsdelivr.net/gh/hufilter/hufilter@gh-pages/hufilter-dns.txt"
},
new
{