1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

Include SQLite in migrations (#2559)

This commit is contained in:
Matt Gibson 2023-01-12 08:59:00 -05:00 committed by GitHub
parent e06323d94b
commit 09e524c9a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,13 +6,13 @@
# in the future and investigate if we can migrate back. # in the future and investigate if we can migrate back.
# docker-compose --profile mssql exec mssql bash /mnt/helpers/run_migrations.sh @args # docker-compose --profile mssql exec mssql bash /mnt/helpers/run_migrations.sh @args
param([switch]$all = $false, [switch]$postgres = $false, [switch]$mysql = $false, [switch]$mssql = $false) param([switch]$all = $false, [switch]$postgres = $false, [switch]$mysql = $false, [switch]$mssql = $false, [switch]$sqlite = $false)
if (!$all -and !$postgres -and !$mysql) { if (!$all -and !$postgres -and !$mysql -and !$sqlite) {
$mssql = $true; $mssql = $true;
} }
if ($all -or $postgres -or $mysql) { if ($all -or $postgres -or $mysql -or $sqlite) {
dotnet ef *> $null dotnet ef *> $null
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Entity Framework Core tools were not found in the dotnet global tools. Attempting to install" Write-Host "Entity Framework Core tools were not found in the dotnet global tools. Attempting to install"
@ -35,14 +35,13 @@ if ($all -or $mssql) {
$currentDir = Get-Location $currentDir = Get-Location
if ($all -or $mysql) { Foreach ($item in @(@($mysql, "MySQL", "MySqlMigrations"), @($postgres, "PostgreSQL", "PostgresMigrations"), @($sqlite, "SQLite", "SqliteMigrations"))) {
Write-Host "Starting MySQL Migrations" if (!$item[0] -and !$all) {
Set-Location "$currentDir/../util/MySqlMigrations/" continue
dotnet ef database update }
}
if ($all -or $postgres) { Write-Host "Starting $($item[1]) Migrations"
Write-Host "Starting PostgreSQL Migrations" Set-Location "$currentDir/../util/$($item[2])/"
Set-Location "$currentDir/../util/PostgresMigrations/"
dotnet ef database update dotnet ef database update
} }