PSU 2026.1.5
I migrated from SQLite to SQL server 2017 CU31 with:
.\psu db migrate -scn 'Data Source=C:\ProgramData\UniversalAutomation\database.db' -tcn 'Data Source=SQLServer;Initial Catalog=PSU;Integrated Security=True;TrustServerCertificate=true' -tdt 'SQL'
Data load seemed to go fine. I changed the Appsettings.json file to reflect:
{
"Kestrel": {
"Endpoints": {
"HTTP": {
"Url": "http://*:5000"
}
}
},
"Plugins": [
"SQL"
],
"Data": {
"RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
"ConnectionString": "Data Source=SQLServer;Initial Catalog=PSU;Integrated Security=True;TrustServerCertificate=true"
},
"Mode": "Server",
"PSUTelemetry": true
}
Service won't start. Windows event log shows:
Faulting application name: Universal.Server.exe, version: 1.0.0.0, time stamp: 0x69970000 Faulting module name: KERNELBASE.dll, version: 10.0.17763.8755, time stamp: 0x44e2a81a Exception code: 0xe0434352 Fault offset: 0x0000000000041b39 Faulting process id: 0x1d1c Faulting application start time: 0x01dcef98f9e03c82 Faulting application path: C:\Program Files (x86)\Universal\Universal.Server.exe Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll Report Id: 6eae0462-2c56-4aa6-b783-252bf3c31609 Faulting package full name: Faulting package-relative application ID: Application: Universal.Server.exe CoreCLR Version: 9.0.1426.11910 .NET Version: 9.0.14 Description: The process was terminated due to an unhandled exception. Exception Info: Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'Computer' in the database. at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose) at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite) at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName) at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.Execute(IReadOnlyList`1 migrationCommands, IRelationalConnection connection, MigrationExecutionState executionState, Boolean beginTransaction, Boolean commitTransaction, Nullable`1 isolationLevel) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.<>c.<ExecuteNonQuery>b__3_1(DbContext _, ValueTuple`6 s) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IReadOnlyList`1 migrationCommands, IRelationalConnection connection, MigrationExecutionState executionState, Boolean commitTransaction, Nullable`1 isolationLevel) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.MigrateImplementation(DbContext context, String targetMigration, MigrationExecutionState state, Boolean useTransaction) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<>c.<Migrate>b__20_1(DbContext c, ValueTuple`4 s) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<>c__DisplayClass28_0`2.<Execute>b__0(DbContext context, TState state) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade) at PowerShellUniversal.SQL.DatabaseFeature.InitializeDatabase(IConfiguration configuration, ILogger logger) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.SQL\Plugin.cs:line 117 at Universal.Server.Services.SystemPluginService..ctor(IConfiguration configuration) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Services\SystemPluginService.cs:line 48 at Universal.Server.Startup.ConfigureServices(IServiceCollection services) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Startup.cs:line 75 at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass7_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services) at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at Universal.Server.Program.Main(String[] args) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Program.cs:line 43 ClientConnectionId:459dc18c-b5f3-462e-a418-db40f7d99c47 Error Number:2714,State:6,Class:16
I've search the old forum and unless I missed something, the post seem to be a couple of years old and reference the old DataMigration.exe.
Any ideas?
Thanks,
@alonzohess It seems a bit like that schema wasn't updated properly during the migration. I noticed a bug in the psu.exe where if you used --create-database on the migration command, it ended up using a command that prevents migrations working in the future (open a bug for it). That said, I don't see that in your command. Did you create the database schema a different way?
Can you check the __EFMigrationsHistory table within the database (if it exists) and me know the most recent version it is report?
If this was an easy process for you to run the migration, I would recommend renaming or recreating the database through migration with these two commands. It will recreate the database and set it up properly to use schema migrations and then migrate the data:
.\psu db schema -cn 'Data Source=SQLServer;Initial Catalog=PSU;Integrated Security=True;TrustServerCertificate=true' .\psu db migrate -scn 'Data Source=C:\ProgramData\UniversalAutomation\database.db' -tcn 'Data Source=SQLServer;Initial Catalog=PSU;Integrated Security=True;TrustServerCertificate=true' -tdt 'SQL'
Adam Driscoll
PowerShell Expert and Developer at Devolutions