2023-08-06 15:03:36 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
|
|
# Define the modules to update
|
2023-10-25 20:46:06 +00:00
|
|
|
mods=("Runtime")
|
|
|
|
|
# mods=("Alterations" "Runtime" "Management" "Identity" "Labels")
|
2023-08-06 15:03:36 +00:00
|
|
|
|
|
|
|
|
# Define the list of providers
|
2023-08-21 19:17:40 +00:00
|
|
|
providers=("MySql" "SqlServer" "Sqlite" "PostgreSql")
|
2023-10-15 12:24:33 +00:00
|
|
|
# providers=("SqlServer")
|
2023-08-06 15:03:36 +00:00
|
|
|
|
|
|
|
|
# Connection strings for each provider
|
|
|
|
|
typeset -A connStrings
|
|
|
|
|
connStrings=(
|
|
|
|
|
MySql "Server=localhost;Port=3306;Database=elsa;User=root;Password=password;"
|
|
|
|
|
SqlServer ""
|
|
|
|
|
Sqlite ""
|
|
|
|
|
PostgreSql ""
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Loop through each module
|
|
|
|
|
for module in "${mods[@]}"; do
|
|
|
|
|
# Loop through each provider
|
|
|
|
|
for provider in "${providers[@]}"; do
|
|
|
|
|
providerPath="./src/modules/Elsa.EntityFrameworkCore.$provider"
|
|
|
|
|
migrationsPath="Migrations/$module"
|
|
|
|
|
|
|
|
|
|
echo "Updating migrations for $provider..."
|
|
|
|
|
echo "Provider path: ${providerPath:?}/${migrationsPath}"
|
|
|
|
|
echo "Migrations path: $migrationsPath"
|
|
|
|
|
echo "Connection string: ${connStrings[$provider]}"
|
|
|
|
|
|
|
|
|
|
# 1. Delete the existing migrations folder
|
|
|
|
|
rm -rf "${providerPath:?}/${migrationsPath}"
|
|
|
|
|
|
|
|
|
|
# 2. Run the migrations command
|
2023-10-07 10:47:36 +00:00
|
|
|
dotnet ef migrations add Initial -c "$module"ElsaDbContext -p "$providerPath" -o "$migrationsPath" -- --connectionString "${connStrings[$provider]}"
|
2023-08-06 15:03:36 +00:00
|
|
|
done
|
|
|
|
|
done
|