36 lines
1.0 KiB
Markdown
36 lines
1.0 KiB
Markdown
# Backend
|
||
|
||
|
||
# ApiService
|
||
|
||
Строка подключения в appsettings.json:
|
||
username:postgres
|
||
password:postgres
|
||
host:localhost
|
||
port:5432
|
||
database:prod
|
||
|
||
|
||
|
||
Если нет миграций в проекте то в папке HackathonPreparing.ApiService нужно писать:
|
||
|
||
dotnet ef migrations add UserContextMigration --context UserContext
|
||
dotnet ef database update --context UserContext
|
||
|
||
dotnet ef migrations add WeatherForecastContextMigration --context WeatherForecastContext
|
||
dotnet ef database update --context WeatherForecastContext
|
||
|
||
И так для каждого DbContext в проекте
|
||
|
||
Если в папке HackathonPreparing.ApiService есть папка Migrations и там есть миграции то можно просто сделать запрос post: /api/db/migrate.
|
||
Все запросы к маршрутам /api/db/... доступны только в dev моде
|
||
|
||
|
||
|
||
/api/swagger - путь к свагеру
|
||
|
||
из свагера в dev моде можно запустить миграции в /api/db/migrate
|
||
|
||
|
||
|