You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
├── Configurations/ — Options classes bound from appsettings.json
36
36
├── Middlewares/ — Custom ASP.NET Core middleware
37
-
├── Data/ — DbContext + DbInitializer (seed data)
38
-
└── Storage/ — SQLite database file (players.db)
37
+
├── Data/ — DbContext; seed data via HasData() in OnModelCreating
38
+
└── Storage/ — SQLite database file (created at runtime by MigrateAsync)
39
39
40
40
test/Dotnet.Samples.AspNetCore.WebApi.Tests/
41
41
├── Unit/ — Unit tests (controllers, services, validators)
@@ -206,7 +206,7 @@ This project uses Spec-Driven Development (SDD): discuss in Plan mode first, cre
206
206
207
207
**Add an endpoint**: Add DTO in `Models/` → update `PlayerMappingProfile` in `Mappings/` → add repository method(s) in `Repositories/` → add service method in `Services/` → add controller action in `Controllers/` → add/update validator rule set in `Validators/` → add tests in `test/.../Unit/` → run pre-commit checks.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,9 @@ This project uses famous football stadiums (A-Z) that hosted FIFA World Cup matc
54
54
55
55
### Changed
56
56
57
+
- Replace pre-seeded `storage/players-sqlite3.db` binary blob with EF Core `MigrateAsync()` at startup: schema and seed data are now applied automatically before the first request is served; `STORAGE_PATH` env var controls the database file path (Docker volume path in production, `AppContext.BaseDirectory/storage/` locally); the committed database file, `Dockerfile` db copy step, and `scripts/run-migrations-and-copy-database.sh` have been removed (#459)
58
+
- Recreate EF Core migrations using `HasData()` in `OnModelCreating`: three self-contained migrations (`InitialCreate` DDL, `SeedStarting11` DML, `SeedSubstitutes` DML) generated by EF Core with literal `InsertData` values — no migration calls application methods; `NormalizePlayerDataset` patch migration eliminated by folding corrections into seed data from the start (#459)
59
+
- Replace `DatabaseFakes.CreateTable()` (placeholder schema) and `DatabaseFakes.Seed()` (manual insert bypassing migrations) with `DatabaseFakes.MigrateAsync()`, which applies the full EF Core migration chain on in-memory SQLite (#459)
57
60
- Switch runtime base image from `mcr.microsoft.com/dotnet/aspnet:10.0` (Debian)
58
61
to `mcr.microsoft.com/dotnet/aspnet:10.0-alpine` (before: 113.4 MB →
59
62
after: 73.9 MB compressed; measured via `docker manifest inspect` and
Copy file name to clipboardExpand all lines: README.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,7 +161,7 @@ Before you begin, ensure you have the following installed:
161
161
162
162
- .NET 10 SDK (LTS) or higher
163
163
- Docker Desktop (optional, for containerized deployment)
164
-
- dotnet-ef CLI tool (for database migrations)
164
+
- dotnet-ef CLI tool (optional, for creating new migrations)
165
165
166
166
```bash
167
167
dotnet tool install --global dotnet-ef
@@ -206,7 +206,7 @@ docker compose build
206
206
docker compose up
207
207
```
208
208
209
-
> 💡 On first run, the container copies a pre-seeded SQLite database into a persistent volume. On subsequent runs, that volume is reused and the data is preserved.
209
+
> 💡 On first run, the app applies EF Core migrations and seeds the database automatically into a persistent volume. On subsequent runs, that volume is reused and the data is preserved.
210
210
211
211
### Stop the application
212
212
@@ -216,7 +216,7 @@ docker compose down
216
216
217
217
### Reset the database
218
218
219
-
To remove the volume and reinitialize the database from the built-in seed file:
219
+
To remove the volume and let the app re-create and re-seed the database on next startup:
Copy file name to clipboardExpand all lines: adr/0003-use-sqlite-for-data-storage.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,14 @@ The cross-language comparison set (Go/Gin, Java/Spring Boot, Python/FastAPI, Rus
14
14
15
15
## Decision
16
16
17
-
We will use SQLite as the database engine, accessed through Entity Framework Core. The database file is stored at `storage/players-sqlite3.db`and is pre-seeded with sample data. Docker deployments mount the file into a named volume so data survives container restarts.
17
+
We will use SQLite as the database engine, accessed through Entity Framework Core. The database file is created at `storage/players-sqlite3.db`at runtime: EF Core applies pending migrations (schema + seed data via `HasData()`) automatically at startup via `MigrateAsync()` before the first request is served. Docker deployments mount the file into a named volume so data survives container restarts.
18
18
19
19
## Consequences
20
20
21
21
### Positive
22
22
- Zero-config: no server process, no connection string credentials, no Docker service dependency for local development.
23
-
- The database file can be committed to the repository as seed data, making onboarding instant.
24
23
- EF Core abstracts the SQL dialect, so migrating to another database requires changing only the provider registration.
24
+
-`MigrateAsync()` at startup ensures the schema is always up to date, making onboarding instant without committing binary database files.
25
25
26
26
### Negative
27
27
- SQLite does not support concurrent writes, making it unsuitable for multi-instance deployments or high-throughput scenarios.
0 commit comments