let loadUserModel () =
let assemblyFolder = Path.GetDirectoryName(Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)
let resolutionFolder = Path.Combine(assemblyFolder, "../../../TempDBImpl")
UserModel.Load(resolutionFolder, ".")
let migrate connectionString =
let backend : IBackend = unbox (Rezoom.SQL.Compiler.Postgres.PostgresBackend())
let connection = Configuration.ConnectionStringSettings("Test", connectionString)
connection.ProviderName <- "Npgsql"
let result = <@ (%backend.MigrationBackend) connection @>
let migrationBackend = result.Evaluate()
let model = loadUserModel()
MigrationExtensions.Run ((model.Migrations.ToArray()), MigrationConfig.Default, fun () -> migrationBackend)
Note that this requires pulling in a library just to execute the expressions ( result.Evaluate() ).
It would be great if SQLModel<".">.Migrate() had an overload to take a connection string instead of just the name of a connectionName from a config.
From looking at the code, it looks like it would be pretty easy to add a MigrateUsingConnectionString. If that's acceptable I might find some time to create a PR for it.
Note that this requires pulling in a library just to execute the expressions (
result.Evaluate()
).It would be great if
SQLModel<".">.Migrate()
had an overload to take a connection string instead of just the name of aconnectionName
from a config.