From c6257da717fcea487550a7d62b7c45db3f0aa976 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Tue, 18 Jun 2024 13:14:57 -0400 Subject: [PATCH] Updated Readme and script to add migrations --- README.md | 9 ++++++--- Scripts/Migrations/Linux/AddUpdate.sh | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 5e5362c..26fac34 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Prior to starting the API, the Migrations must be applied. There are 6 tables wi * Song * Album * Artist -* Year +* CoverArt * Genre There is a script for Linux systems to apply these migrations, it can be found in the [Scripts/Migrations/Linux](https://github.com/kdeng00/Icarus/blob/master/Scripts/Migrations/Linux/AddUpdate.sh) directory. Just merely execute: @@ -126,12 +126,15 @@ scripts/Migrations/Linux/AddUpdate.sh ``` Or you can manually add the migrations like so for each migration: ```shell -dotnet ef migrations Add [Migration] --context [Migration]Context +dotnet-ef migrations Add InitialCreate --context UserContext ``` Then update the migrations to the database like so*: ```shell -dotnet ef database update --context [Migration]Context +dotnet-ef database update --context UserContext ``` + +All of the contexts can be found in Database/Contexts folder. + From this point the database has been successfully configured. Metadata and song filesystem locations can be saved. * Will only need to execute this for UserContext and SongContext because the Song table has relational constraints with Album, Artist, Year, and Genre. diff --git a/Scripts/Migrations/Linux/AddUpdate.sh b/Scripts/Migrations/Linux/AddUpdate.sh index 04e72bd..6a1759c 100644 --- a/Scripts/Migrations/Linux/AddUpdate.sh +++ b/Scripts/Migrations/Linux/AddUpdate.sh @@ -1,26 +1,27 @@ echo "Adding migrations..." echo "Adding User migration" -dotnet ef migrations add User --context UserContext -echo "Adding Song migration" -dotnet ef migrations add Song --context SongContext +dotnet-ef migrations add User --context UserContext echo "Adding Album migration" -dotnet ef migrations add Album --context AlbumContext +dotnet-ef migrations add Album --context AlbumContext echo "Adding Artist migration" -dotnet ef migrations add Artist --context ArtistContext +dotnet-ef migrations add Artist --context ArtistContext echo "Adding Genre migration" -dotnet ef migrations add Genre --context GenreContext -echo "Adding Year migration" -dotnet ef migrations add Year --context YearContext +dotnet-ef migrations add Genre --context GenreContext echo "Adding Cover art migration" -dotnet ef migrations add CoverArt --context CoverArtContext +dotnet-ef migrations add CoverArt --context CoverArtContext +echo "Adding Song migration" +dotnet-ef migrations add Song --context SongContext echo "Updating migrations.." echo "Updating User migration" -dotnet ef database update --context UserContext -echo "Updating Song migration" +dotnet-ef database update --context UserContext echo "Updating Album migration" +dotnet-ef database update --context AlbumContext echo "Updating Artist migration" +dotnet-ef database update --context ArtistContext echo "Updating Genre migration" -echo "Updating Year migration" +dotnet-ef database update --context GenreContext echo "Updating Cover art migration" -dotnet ef database update --context SongContext +dotnet-ef database update --context CoverArtContext +echo "Updating Song migration" +dotnet-ef database update --context SongContext