Skip to content

Commit cd9baa1

Browse files
authored
refine entity framework database setup with lessons learned (#596)
1 parent c23dd27 commit cd9baa1

File tree

1 file changed

+26
-3
lines changed
  • docs/getting-started/server/database/ef

1 file changed

+26
-3
lines changed

docs/getting-started/server/database/ef/index.mdx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,39 @@ You can have multiple databases configured and switch between them by changing t
6969
In the `dev` folder of your server repository, run
7070

7171
```bash
72+
export POSTGRES_PASSWORD='example'
7273
docker compose --profile postgres up
7374
```
7475

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+
7583
</TabItem>
7684
<TabItem value="mysql">
7785

7886
In the `dev` folder of your server repository, run
7987

8088
```bash
89+
export MYSQL_ROOT_PASSWORD='example'
8190
docker compose --profile mysql up
8291
```
8392

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+
84100
</TabItem>
85101
<TabItem value="sqlite">
86102

87-
Select a location for your database file. You can use the `dev` folder of your server repository,
88-
git is configured to ignore `.db` files in this repository for this purpose.
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.
89105

90106
</TabItem>
91107
</Tabs>
@@ -126,7 +142,7 @@ Source path. Use the file location selected in [Database Setup](#database-setup)
126142

127143
```json
128144
"globalSettings:databaseProvider": "sqlite",
129-
"globalSettings:sqlite:connectionString": "Data Source=/path/to/your/server/repo/dev/db/bitwarden.db",
145+
"globalSettings:sqlite:connectionString": "Data Source=/path/to/your/server/repo/dev/bitwarden.db",
130146
```
131147

132148
</TabItem>
@@ -176,6 +192,13 @@ pwsh migrate.ps1 -sqlite
176192

177193
The `-sqlite` flag on `migrate.ps1` will run `dotnet ef` commands to perform the migrations.
178194

195+
:::note
196+
197+
The migrator creates the database file if it doesn't exist, but it does not create folders. If you
198+
get an error that the path doesn't exist, it's referring to missing folders.
199+
200+
:::
201+
179202
</TabItem>
180203
</Tabs>
181204

0 commit comments

Comments
 (0)