Skip to main content
The AIpkg data layer uses EasyAF (easyaf.dev) to eliminate hand-written EF migrations and enforce the SQL Server Database Project as the authoritative schema source.

EasyAF Overview

EasyAF provides:

SQL Server DB Project

The .sqlproj is the authoritative schema. No hand-written EF migrations.

Entity Generation

EasyAF CLI reads the .sqlproj and generates EF Core 10 entity classes.

Repository Generation

Standard CRUD repository classes are generated, reducing boilerplate.

OData Restier

Used exclusively for the internal admin/management API surface. Not exposed publicly.

Data Layer Projects

AIpkg.Server.Db/          (.sqlproj)
  Tables/
    Packages.sql
    PackageVersions.sql
    PackageOwners.sql
    Users.sql
    ApiKeys.sql
    Downloads.sql

AIpkg.Server.Data/        (generated by EasyAF)
  Entities/
    Package.cs            ← generated from Packages.sql
    PackageVersion.cs     ← generated from PackageVersions.sql
  Repositories/
    PackageRepository.cs  ← generated CRUD
  AIpkgDbContext.cs       ← generated EF Core DbContext

Schema Definitions

AIpkg Table Schema (from NuGetGallery)

NuGetGallery sourceAIpkg tableChanges
PackagesPackagesRemove: RequiresLicenseAcceptance, DevelopmentDependency, IsSymbolsPackage. Add: Capabilities, Targets, Permissions (JSON columns)
PackageVersionsPackageVersionsSame as above; keep download count
PackageOwnersPackageOwnersNo change
UsersUsersKeep; remove legacy OpenID fields
CredentialsCredentialsKeep PBKDF2 API key structure
PackageDependenciesPackageDependenciesAdd Apms column (JSON) instead of TargetFramework
PackageTagsPackageTagsNo change
PackageHistoriesPackageHistoriesNo change
PackageRenames(drop)Not needed
SymbolPackages(drop)Not applicable

New JSON Columns

Three new JSON columns on Packages / PackageVersions:
ColumnJSON TypeExample
Capabilitiesstring[]["skill","command"]
Targetsstring[]["claude-code","cursor"]
Permissionsstring[]["filesystem:read","network:outbound"]
These are stored as nvarchar(max) JSON columns and indexed via computed columns where needed for Azure AI Search sync.

Schema Change Workflow

1

Edit SQL files

Edit .sql files in AIpkg.Server.Db/.
2

Regenerate entities

Run EasyAF codegen to regenerate entities in AIpkg.Server.Data/.
3

Publish DB project

Publish the .sqlproj to the target database (generates and runs migration scripts).
4

Commit changes

Commit both .sqlproj changes and regenerated entity files.

EasyAF Code Generation

Run EasyAF CLI against AIpkg.Server.Db/ to generate:
easyaf generate --project AIpkg.Server.Db --output AIpkg.Server.Data
This produces:
  • AIpkg.Server.Data/Entities/*.cs — one file per table, strongly typed
  • AIpkg.Server.Data/Repositories/*.cs — standard CRUD repositories
  • AIpkg.Server.Data/AIpkgDbContext.cs — EF Core DbContext with all DbSet<T> properties
Generated files are committed to the repo. The .gitignore does not exclude them — they are the contract between the DB schema and the application code.

Admin API (OData Restier)

EasyAF’s OData Restier integration is used exclusively for the internal admin/management API surface. It is:
  • Not on the public surface (no public routes)
  • Not in scope for the public Registry API spec
  • Accessible only to admin-role authenticated users via internal tooling
Restier auto-generates an OData feed from AIpkgDbContext, providing a fully explorable admin API without hand-written controllers.