Use a local SQLite3 backend instead of PostgreSQL Docker container.
* The provided SQLite3 database contains the required schemas, but no data and can be reset to if required. * Remove all references to PostgreSQL in documentation and configuration. * Replace native sqlite3 command with a console app to remove dependency on SQLite3 installation.
This commit is contained in:
42
README.md
42
README.md
@@ -7,7 +7,7 @@ This exercise is designed to test your skills in C# and .NET.
|
||||
* .NET 8.0 / C#
|
||||
* Minimal ASP.NET Core Web API
|
||||
* Entity Framework Core
|
||||
* PostgreSQL Database (Docker)
|
||||
* SQLite3 Database (simplified for portability)
|
||||
* HttpClient for downstream REST API calls
|
||||
* ???
|
||||
|
||||
@@ -49,15 +49,11 @@ sequenceDiagram
|
||||
**Success Criteria: Verify that the post has been saved with the database with:**
|
||||
|
||||
```bash
|
||||
$ docker compose exec --env PGPASSWORD=password db psql -h localhost -U user --db mydatabase -c "select * from posts;"
|
||||
$ dotnet run --project show-posts/
|
||||
|
||||
id | user_id | title | body | updated_at
|
||||
----+---------+----------------------------------------------------------------------------+-----------------------------------------------------+------------------------
|
||||
1 | 1 | sunt aut facere repellat provident occaecati excepturi optio reprehenderit | quia et suscipit +| 1970-01-01 00:00:00+00
|
||||
| | | suscipit recusandae consequuntur expedita et cum +|
|
||||
| | | reprehenderit molestiae ut ut quas totam +|
|
||||
| | | nostrum rerum est autem sunt rem eveniet architecto |
|
||||
(1 row)
|
||||
| Id | UserId | Title | Body | UpdatedAt |
|
||||
| -- | ------ | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
|
||||
| 1 | 1 | sunt aut facere repellat provident occaecati excepturi optio reprehenderit | quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto | 1/1/1970 12:00:00 AM +00:00 |
|
||||
```
|
||||
|
||||
### Phase 2
|
||||
@@ -105,34 +101,10 @@ $ docker compose exec --env PGPASSWORD=password db psql -h localhost -U user --d
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Start database manually
|
||||
|
||||
Open a terminal at the repo root and execute
|
||||
|
||||
```bash
|
||||
$ docker compose up -d db
|
||||
|
||||
[+] Running 3/3
|
||||
✔ Network dotnet-interview-exercise_default Created 0.0s
|
||||
✔ Volume "dotnet-interview-exercise_db_data" Created 0.0s
|
||||
✔ Container dotnet-interview-exercise-db-1 Started 0.1s
|
||||
```
|
||||
|
||||
### Cleanup database
|
||||
|
||||
In case something went wrong, wipe and rebuild the database
|
||||
In case something went wrong or you want to start over, wipe the database by resetting the SQLite file.
|
||||
|
||||
```bash
|
||||
$ docker compose down -v
|
||||
|
||||
[+] Running 3/3
|
||||
✔ Container dotnet-interview-exercise-db-1 Removed. 0.2s
|
||||
✔ Network dotnet-interview-exercise_default Removed. 0.2s
|
||||
✔ Volume dotnet-interview-exercise_db_data Removed. 0.0s
|
||||
|
||||
$ docker compose up -d db
|
||||
[+] Running 3/3
|
||||
✔ Network dotnet-interview-exercise_default Created 0.0s
|
||||
✔ Volume "dotnet-interview-exercise_db_data" Created 0.0s
|
||||
✔ Container dotnet-interview-exercise-db-1 Started 0.1s
|
||||
git restore service/service.db
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user