Set fixed version for MySql
This commit is contained in:
parent
b38ff41c6d
commit
8a9e00d92d
|
|
@ -8,15 +8,6 @@ mods=("Management" "Runtime")
|
|||
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
|
||||
|
|
@ -27,7 +18,6 @@ for module in "${mods[@]}"; do
|
|||
echo "Updating migrations for $provider..."
|
||||
echo "Provider path: ${providerPath:?}/${migrationsPath}"
|
||||
echo "Migrations path: $migrationsPath"
|
||||
echo "Connection string: ${connStrings[$provider]}"
|
||||
|
||||
# 1. Remove all migrations except the initial and restore the snapshot to that state.
|
||||
migrations=$(dotnet ef migrations list --no-connect -c "$module"ElsaDbContext -p "$providerPath" | grep -v ^Build | grep -v ^"Pending status" | grep -v Initial$)
|
||||
|
|
@ -37,6 +27,6 @@ for module in "${mods[@]}"; do
|
|||
done
|
||||
|
||||
# 2. Run the migrations command
|
||||
dotnet ef migrations add V3_1 -c "$module"ElsaDbContext -p "$providerPath" -o "$migrationsPath" --connectionString "${connStrings[$provider]}"
|
||||
dotnet ef migrations add V3_1 -c "$module"ElsaDbContext -p "$providerPath" -o "$migrationsPath"
|
||||
done
|
||||
done
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public static class DbContextOptionsBuilderExtensions
|
|||
public static DbContextOptionsBuilder UseElsaMySql(this DbContextOptionsBuilder builder, Assembly migrationsAssembly, string connectionString,ElsaDbContextOptions? options = default, Action<MySqlDbContextOptionsBuilder>? configure = default) =>
|
||||
builder
|
||||
.UseElsaDbContextOptions(options)
|
||||
.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), db =>
|
||||
.UseMySql(connectionString, ServerVersion.Create(7,0,14, ServerType.MySql), db =>
|
||||
{
|
||||
db
|
||||
.MigrationsAssembly(options.GetMigrationsAssemblyName(migrationsAssembly))
|
||||
|
|
|
|||
Loading…
Reference in a new issue