- Run
rebuild solution
to install all dependencies. - In the Package Manager Console, select the StockManager.Database as the Default project and run
Update-Database
to create theApp.db.sqlite
file in/StockManager
folder.
👉 The database will have a default user with the credentials, username: Admin
and password: admin
.
Notes:
If the file App.db.sqlite
isn't in the project StockManager
-
Include it into the project.
-
Right click on it and go to properties.
-
Change the Copy to Output Directory to
Copy if newer
. With this changes, your DB file will be copied to project/bin/debug
directory on the run, if it is newer. -
Change the code that has been added to the file StockManager.csproj to be the following:
<None Include="App.db.sqlite" Condition="Exists('.\App.db.sqlite')"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>
👉 From now on, your application will save the data in the /bin/debug/App.db.sqlite
. The App.db.sqlite
outside the /bin/debug
will remain with the initial values only.
-
Create a migration:
Add-Migration MIGRATION_NAME
-
Create a migration in a specific folder:
Add-Migration MIGRATION_NAME -OutputDir Source/Migrations
👉 You don't need to specify the output directory for subsequent migrations since they are created as siblings to the last one.
-
Update the DB with the last changes:
Update-Database
-
Undo the last migration:
Remove-Migration
-
Forcing undo the last migration:
Remove-Migration -Force