Skip to content

Commit e362799

Browse files
committed
Add information on doing a database migration
1 parent 55598a6 commit e362799

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Contributing
22

3+
See more documentation in the `docs` folder.
4+
35
## Building
46

57
### Requirements

docs/database.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Database
2+
3+
We use [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) with SQLite as our [database provider](https://docs.microsoft.com/en-us/ef/core/providers/sqlite/?tabs=dotnet-core-cli).
4+
5+
## Updating the Database Model
6+
7+
1. Add or remove properties in the model classes.
8+
2. Open the Package Manager Console in Visual Studio
9+
3. Ensure the default project is selected as `Signal-Windows.Lib` as this is where the DbContext classes are.
10+
4. Run `Add-Migration <migration name> -Context <DbContext class>`. Typically `migration name` is just the number of the migration (m4, m5, m6, etc.). `DbContext class` is the class name of the DB we're migrating. Most migrations are to `SignalDBContext` but `LibsignalDBContext` is also valid.
11+
5. Debug the app to ensure the migration runs successfully. Migrations are triggered [here](https://github.com/signal-csharp/Signal-Windows/blob/55598a6bdf57ce22f48fc18bc587b257122115a0/Signal-Windows/App.xaml.cs#L60-L61) as soon as the app is started up.

0 commit comments

Comments
 (0)