FluentMigrator.DotNet.Cli --no-connection throws exception
See original GitHub issueI am trying to generate a migration script without a live database running. The following command results in an exception.
dotnet-fm migrate -p Postgres --no-connection -a Migrations.dll -o=db.sql
-------------------------------------------------------------------------------
2018111900: Migration2018111900 migrating
-------------------------------------------------------------------------------
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey)
at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms, Boolean useOdbcRules)
at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
at Npgsql.NpgsqlConnection.GetPoolAndSettings()
at FluentMigrator.Runner.Processors.GenericProcessorBase.<>c__DisplayClass6_1.<.ctor>b__1() in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner.Core/Processors/GenericProcessorBase.cs:line 102
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at FluentMigrator.Runner.Processors.GenericProcessorBase.EnsureConnectionIsOpen() in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner.Core/Processors/GenericProcessorBase.cs:line 128
at FluentMigrator.Runner.Processors.GenericProcessorBase.BeginTransaction() in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner.Core/Processors/GenericProcessorBase.cs:line 146
at FluentMigrator.Runner.MigrationScopeHandler.BeginScope() in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner/MigrationScopeHandler.cs:line 37
at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction) in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner/MigrationRunner.cs:line 519
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement) in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner/MigrationRunner.cs:line 365
at FluentMigrator.Runner.Initialization.TaskExecutor.Execute() in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.Runner/Initialization/TaskExecutor.cs:line 165
at FluentMigrator.DotNet.Cli.Commands.BaseCommand.ExecuteMigrations(MigratorOptions options, IConsole console) in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.DotNet.Cli/Commands/BaseCommand.cs:line 32
at FluentMigrator.DotNet.Cli.Commands.Migrate.OnExecute(IConsole console) in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.DotNet.Cli/Commands/Migrate.cs:line 35
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 64
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.<OnExecute>b__0() in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.cs:line 505
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context) in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.Execute.cs:line 31
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args) in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.Execute.cs:line 97
at FluentMigrator.DotNet.Cli.Program.Main(String[] args) in /home/travis/build/fluentmigrator/fluentmigrator/src/FluentMigrator.DotNet.Cli/Program.cs:line 35
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Upgrade Guide from 2.0 to 3.0
NET Core 2.1-preview2 tooling. This allows the usage of dotnet fm migrate from other directories than the project directory. Connection string handling changes....
Read more >dotnet-fm tool
DotNet.Cli tool and directly package your migrations DLL with the tool so that the MSBuild Microsoft.NET.Sdk correctly builds a project.deps.json used to ...
Read more >Upgrade Guide from 3.1 to 3.2
A value for the identity column is generated by the database when no value was given. Attepts to insert a NULL value will...
Read more >Fluent migrator throws timout exception
I using Fluent migrator 3.3. 2, which throws error on one of databases: The error was Execution Timeout Expired. The timeout period elapsed ......
Read more >FAQ | FluentMigrator documentation
DotNet.Cli contains an --allowDirtyAssemblies switch that will allow you to ... TargetInvocationException: Exception has been thrown by the target of an ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@igitur Thanks for mentioning this. I opened a new ticket. In the future, consider opening a ticket as I almost lost track of this. I was on vacation for one week. If I was on vacation for two, my brain probably would’ve been too foggy to remember your comment in this email 😃 LOL
Hi
Just upgraded from v3.1.3 to v3.2.1 and I noticed that 156f5f6723e6e7ffb00909e8115b976fa7a9da3b broke something for me. I’m also generating a
.sql
file containing all my migrations, using.AsGlobalPreview()
, but I would like each migration to be wrapped in aBEGIN TRANSACTION
andCOMMIT TRANSACTION
in the output SQL.After 156f5f6723e6e7ffb00909e8115b976fa7a9da3b this
BeginScope();
is never called so I don’t see the transaction statements in my generated SQL anymore. To me, this is a breaking change/regression.