40
40
41
41
Our EF implementations currently support Postgres, MySQL, and SQLite3.
42
42
43
- ## Setting Up EF Databases
43
+ ## Creating the database
44
44
45
- The workflow here is broadly the same as with the normal MSSQL implementation: set up the docker
45
+ The workflow here is broadly the same as with the normal MSSQL implementation: set up the Docker
46
46
container, configure user secrets, and run migrations against their relating databases in
47
47
chronological order.
48
48
@@ -59,53 +59,6 @@ chronological order.
59
59
You can have multiple databases configured and switch between them by changing the value of the
60
60
` globalSettings:databaseProvider ` user secret. You don’t have to delete your connection strings.
61
61
62
- ### Database Setup
63
-
64
- <Tabs
65
- groupId = " provider"
66
- values = { providers } >
67
- <TabItem value = " postgres" >
68
-
69
- In the ` dev ` folder of your server repository, run
70
-
71
- ``` bash
72
- export POSTGRES_PASSWORD=' example'
73
- docker compose --profile postgres up
74
- ```
75
-
76
- :::note
77
-
78
- ` POSTGRES_PASSWORD ` only needs to be defined for database setup. It does not need to be defined to
79
- run the mysql profile.
80
-
81
- :::
82
-
83
- </TabItem >
84
- <TabItem value = " mysql" >
85
-
86
- In the ` dev ` folder of your server repository, run
87
-
88
- ``` bash
89
- export MYSQL_ROOT_PASSWORD=' example'
90
- docker compose --profile mysql up
91
- ```
92
-
93
- :::note
94
-
95
- ` MYSQL_ROOT_PASSWORD ` only needs to be defined for database setup. It does not need to be defined to
96
- run the mysql profile.
97
-
98
- :::
99
-
100
- </TabItem >
101
- <TabItem value = " sqlite" >
102
-
103
- Select a location for your database file. You can use the ` dev ` folder of your server repository.
104
- Git is configured to ignore ` .db ` files in this repository for this purpose.
105
-
106
- </TabItem >
107
- </Tabs >
108
-
109
62
### User secrets
110
63
111
64
Add the following values to your API, Identity, and Admin user secrets.
@@ -138,7 +91,8 @@ sure you update the existing values instead of creating new ones
138
91
<TabItem value = " sqlite" >
139
92
140
93
Add the following values to your API, Identity, and Admin user secrets. Note, you must set the Data
141
- Source path. Use the file location selected in [ Database Setup] ( #database-setup )
94
+ Source path. Git is configured to ignore ` .db ` files in the server repository so that the sqlite
95
+ database can be stored in ` dev ` . You can use any path with write permissions.
142
96
143
97
``` json
144
98
"globalSettings:databaseProvider" : " sqlite" ,
@@ -155,6 +109,62 @@ that the changes take effect.
155
109
156
110
:::
157
111
112
+ ### Updating the database
113
+
114
+ <Tabs
115
+ groupId = " provider"
116
+ values = { providers } >
117
+ <TabItem value = " postgres" >
118
+
119
+ 1 . Confirm that ` POSTGRES_PASSWORD ` in ` dev/.env ` matches the password in ` dev/secrets.json ` .
120
+
121
+ 2 . In the ` dev ` folder of your server repository, run
122
+
123
+ ``` bash
124
+ docker compose --profile postgres up
125
+ ```
126
+
127
+ :::tip[ Confirm your database connection!]
128
+
129
+ If you run into connection errors, double check that your ` .env ` and ` secrets.json ` files have
130
+ matching passwords. If they do, you may have initialized your database incorrectly. Delete the
131
+ Docker storage volume and initialize the database from scratch.
132
+
133
+ :::
134
+
135
+ </TabItem >
136
+ <TabItem value = " mysql" >
137
+
138
+ 1 . Confirm that ` MYSQL_ROOT_PASSWORD ` in ` dev/.env ` matches the password in ` dev/secrets.json ` .
139
+
140
+ 2 . In the ` dev ` folder of your server repository, run
141
+
142
+ ``` bash
143
+ docker compose --profile mysql up
144
+ ```
145
+
146
+ :::tip[ Confirm your database connection!]
147
+
148
+ If you run into connection errors, double check that your ` .env ` and ` secrets.json ` files have
149
+ matching passwords. If they do, you may have initialized your database incorrectly. Delete the
150
+ Docker storage volume and initialize the database from scratch.
151
+
152
+ :::
153
+
154
+ </TabItem >
155
+ <TabItem value = " sqlite" >
156
+
157
+ :::tip[ Confirm your database path!]
158
+
159
+ The migrator creates the database file if it doesn't exist, but it does not create folders. If you
160
+ get an error that the path doesn't exist, double check that the path exists and that the folder
161
+ containing the sqlite database has write and/or create permissions.
162
+
163
+ :::
164
+
165
+ </TabItem >
166
+ </Tabs >
167
+
158
168
### Migrations
159
169
160
170
<Tabs
@@ -168,7 +178,7 @@ In the `dev` folder run the following to update the database to the latest migra
168
178
pwsh migrate.ps1 -postgres
169
179
```
170
180
171
- The ` -postgres ` flag on ` migrate.ps1 ` will run ` dotnet ef ` commands to perform the migrations.
181
+ The ` -postgres ` flag on ` migrate.ps1 ` runs ` dotnet ef ` commands to perform the migrations.
172
182
173
183
</TabItem >
174
184
<TabItem value = " mysql" >
@@ -179,7 +189,7 @@ In the `dev` folder run the following to update the database to the latest migra
179
189
pwsh migrate.ps1 -mysql
180
190
```
181
191
182
- The ` -mysql ` flag on ` migrate.ps1 ` will run ` dotnet ef ` commands to perform the migrations.
192
+ The ` -mysql ` flag on ` migrate.ps1 ` runs ` dotnet ef ` commands to perform the migrations.
183
193
184
194
</TabItem >
185
195
<TabItem value = " sqlite" >
@@ -190,7 +200,7 @@ In the `dev` folder run the following to update the database to the latest migra
190
200
pwsh migrate.ps1 -sqlite
191
201
```
192
202
193
- The ` -sqlite ` flag on ` migrate.ps1 ` will run ` dotnet ef ` commands to perform the migrations.
203
+ The ` -sqlite ` flag on ` migrate.ps1 ` runs ` dotnet ef ` commands to perform the migrations.
194
204
195
205
:::note
196
206
@@ -208,7 +218,7 @@ You can also run migrations for all database providers at once using
208
218
pwsh migrate.ps1 -all
209
219
```
210
220
211
- ### Optional: Verify
221
+ ### Verifying changes
212
222
213
223
If you would like to verify that everything worked correctly:
214
224
@@ -217,7 +227,7 @@ If you would like to verify that everything worked correctly:
217
227
- Note: this requires a configured MSSQL database. You may also need to set up other EF providers
218
228
for tests to pass.
219
229
220
- ## Testing EF Changes
230
+ ## Testing changes
221
231
222
232
In your ` server/dev/secrets.json ` file find or add this block of secrets in the root of the json
223
233
structure:
0 commit comments