Skip to content

Commit

Permalink
feat: run db migrations only manually
Browse files Browse the repository at this point in the history
  • Loading branch information
valchetski committed Jul 28, 2024
1 parent e0e79c2 commit 2d9d2f9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/db-migration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: db-migration

env:
DOTNET_VERSION: '8.*' # set this to the .NET Core version to use

on:
workflow_dispatch:

permissions:
contents: read

jobs:
bundle:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Install dotnet-ef
run: dotnet tool install --global dotnet-ef

- name: Create migrations bundle
run: dotnet ef migrations bundle -p src/Tgvs --output efbundle.exe

- name: Upload artifact with migration bundle
uses: actions/upload-artifact@v3
with:
name: efbundle
path: efbundle.exe


7 changes: 0 additions & 7 deletions src/Tgvs/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using Telegram.Bot;
using Telegram.Bot.Polling;
Expand Down Expand Up @@ -49,10 +48,4 @@

app.MapControllers();

using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<StickersDbContext>();
db.Database.Migrate();
}

app.Run();

0 comments on commit 2d9d2f9

Please sign in to comment.