question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug in SqlServer migration?

See original GitHub issue

In the fold Elsa.Persistence.EntityFrameworkCore,I run the cmd: SET EF_PROVIDER=SqlServer SET EF_CONNECTIONSTRING=“Server=localhost; Database=elsadb; Trusted_Connection=True;” dotnet ef database update but I get the wrong msg: Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘60’] CREATE DATABASE [elsadb]; Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘60’] IF SERVERPROPERTY(‘EngineEdition’) <> 5 BEGIN ALTER DATABASE [elsadb] SET READ_COMMITTED_SNAPSHOT ON; END; Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] CREATE TABLE [__EFMigrationsHistory] ( [MigrationId] nvarchar(150) NOT NULL, [ProductVersion] nvarchar(32) NOT NULL, CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] SELECT OBJECT_ID(N’[__EFMigrationsHistory]'); Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] SELECT [MigrationId], [ProductVersion] FROM [__EFMigrationsHistory] ORDER BY [MigrationId]; Applying migration ‘20191116105145_InitialCreate’. Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] CREATE TABLE [WorkflowDefinitionVersions] ( [Id] INTEGER NOT NULL, [VersionId] TEXT NULL, [DefinitionId] TEXT NULL, [Version] INTEGER NOT NULL, [Name] TEXT NULL, [Description] TEXT NULL, [Variables] TEXT NULL, [IsSingleton] INTEGER NOT NULL, [IsDisabled] INTEGER NOT NULL, [IsPublished] INTEGER NOT NULL, [IsLatest] INTEGER NOT NULL, CONSTRAINT [PK_WorkflowDefinitionVersions] PRIMARY KEY ([Id]) ); Executing DbCommand [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] CREATE TABLE [WorkflowInstances] ( [Id] INTEGER NOT NULL, [InstanceId] TEXT NULL, [DefinitionId] TEXT NULL, [Version] INTEGER NOT NULL, [Status] TEXT NOT NULL, [CorrelationId] TEXT NULL, [CreatedAt] TEXT(48) NOT NULL, [StartedAt] TEXT(48) NULL, [FinishedAt] TEXT(48) NULL, [FaultedAt] TEXT(48) NULL, [AbortedAt] TEXT(48) NULL, [Scopes] TEXT NULL, [Input] TEXT NULL, [ExecutionLog] TEXT NULL, [Fault] TEXT NULL, CONSTRAINT [PK_WorkflowInstances] PRIMARY KEY ([Id]) ); Failed executing DbCommand (5ms) [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] CREATE TABLE [WorkflowInstances] ( [Id] INTEGER NOT NULL, [InstanceId] TEXT NULL, [DefinitionId] TEXT NULL, [Version] INTEGER NOT NULL, [Status] TEXT NOT NULL, [CorrelationId] TEXT NULL, [CreatedAt] TEXT(48) NOT NULL, [StartedAt] TEXT(48) NULL, [FinishedAt] TEXT(48) NULL, [FaultedAt] TEXT(48) NULL, [AbortedAt] TEXT(48) NULL, [Scopes] TEXT NULL, [Input] TEXT NULL, [ExecutionLog] TEXT NULL, [Fault] TEXT NULL, CONSTRAINT [PK_WorkflowInstances] PRIMARY KEY ([Id]) ); Microsoft.Data.SqlClient.SqlException (0x80131904): 第 7 个列、参数或变量: 不能对数据类型 text 指定列宽。 at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlConnection.cs:line 1591 at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) in E:\agent1_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlInternalConnection.cs:line 618 at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in E:\agent1_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1169 at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in E:\agent1_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1719 at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite) in E:\agent1_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlCommand.cs:line 2857 at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName) in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlCommand.cs:line 1395 at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery() in E:\agent1\_work\31\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlCommand.cs:line 974 at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) ClientConnectionId:7051440a-ef14-4099-a858-d4910d2297db Error Number:2716,State:1,Class:16 第 7 个列、参数或变量: 不能对数据类型 text 指定列宽。

is this a bug? thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
prxy15commented, Nov 1, 2020

I am still facing the same issue

image

hi,maybe this can help you

open powershell, in powershell write this:

$Env:EF_CONNECTIONSTRING = "Server=(localdb)\MSSQLLocalDB;Database=OrquestadorDB;User=ELSA;Password=ELSAADMIN!;"

(this work for SqlServer Express from visual studio 2019 community)

then check if env var was ok:

$Env:EF_CONNECTIONSTRING and run migrations in same powershell window

dotnet ef database update --context SqlServerContext

1reaction
zsanhongcommented, Nov 27, 2019

It works. thank you, sfmskywalker.Great job

Read more comments on GitHub >

github_iconTop Results From Across the Web

Monitor and troubleshoot data migration (Stretch Database)
There are several problems that can affect migration. Check the following things. Check network connectivity for the SQL Server computer. Check ...
Read more >
Migrating Microsoft SQL Server to MySQL: Odd errors I can ...
I have a database in SQL Server that I am trying to convert into a MySQL database, so I can host it on...
Read more >
A strange OS bug on a SQL Server migration
A strange OS bug on a SQL Server migration ... This is another situation that happened on a database migration at a client...
Read more >
Error after migrating the database from SQL Server 2005 to a ...
Problem. You have recently moved your database from SQL Server 2005 to a newer version, and now for some actions you see an...
Read more >
[BUG] Database Corruption After Live Migration of ...
During the process of live migrating a Windows Server 2022 with SQL Server installed on it, a bug is encountered where the database...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found