forked from elsa-workflows/elsa-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-migrations-initial copy.sh
38 lines (31 loc) · 1.24 KB
/
generate-migrations-initial copy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env zsh
# Define the modules to update
mods=("Management")
# mods=("Alterations" "Runtime" "Management" "Identity" "Labels")
# Define the list of providers
providers=("MySql" "SqlServer" "Sqlite" "PostgreSql")
# providers=("SqlServer")
# 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
dotnet ef migrations add Initial -c "$module"ElsaDbContext -p "$providerPath" -o "$migrationsPath" -- --connectionString "${connStrings[$provider]}"
done
done