Column, parameter, or variable #1: Cannot specify a column width on data type text.
See original GitHub issueI get this error when running Update-Migration.
///Error message Start
Applying migration ‘20200906170827_V1.0.0.1’. Failed executing DbCommand (8ms) [Parameters=[], CommandType=‘Text’, CommandTimeout=‘30’] CREATE TABLE [AccountGroups_DBSet] ( [GroupName] TEXT(50) NOT NULL, [GroupParent] TEXT(50) NULL, [BalanceSheetSide] TEXT(255) NULL, [Description] TEXT(255) NULL, [IsHidden] INTEGER NOT NULL, [GroupEnd] TEXT(50) NULL, [IsUnderBudgetControl] INTEGER NOT NULL, [BudgetAmount] TEXT(64) NULL, [IsUnderLocationControl] INTEGER NOT NULL, [Location] TEXT(50) NULL, [TxnID] TEXT(36) NOT NULL, [SearchKey] TEXT(150) NULL, [RecordVersion] INTEGER NOT NULL, [CreatedBy] TEXT(50) NOT NULL, [LastUpdatedBy] TEXT(50) NULL, [CreatedOn] TEXT(48) NOT NULL, [LastUpdatedOn] TEXT(48) NULL, [Company] TEXT(100) NULL, CONSTRAINT [PK_AccountGroups_DBSet] PRIMARY KEY ([GroupName]) ); Microsoft.Data.SqlClient.SqlException (0x80131904): Column, parameter, or variable #1: Cannot specify a column width on data type text. at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in …More stack trace omitted
Error Number:2716,State:1,Class:16 Column, parameter, or variable #1: Cannot specify a column width on data type text.
///Error message End
But when I generate SQL Script using dbContext.Database.GenerateCreateScript(), the generated script is different and also works when creating database schema manually. Look at what SQL script saved in a file from the same migration looks like :
CREATE TABLE [AccountGroups_DBSet] ( [GroupName] nvarchar(50) NOT NULL, [GroupParent] nvarchar(50) NULL, [BalanceSheetSide] nvarchar(255) NULL, [Description] nvarchar(255) NULL, [IsHidden] bit NOT NULL, [GroupEnd] nvarchar(50) NULL, [IsUnderBudgetControl] bit NOT NULL, [BudgetAmount] decimal(18,2) NULL, [IsUnderLocationControl] bit NOT NULL, [Location] nvarchar(50) NULL, [TxnID] nvarchar(36) NOT NULL, [SearchKey] nvarchar(150) NULL, [RecordVersion] bigint NOT NULL, [CreatedBy] nvarchar(50) NOT NULL, [LastUpdatedBy] nvarchar(50) NULL, [CreatedOn] datetime2 NOT NULL, [LastUpdatedOn] datetime2 NULL, [Company] nvarchar(100) NULL, CONSTRAINT [PK_AccountGroups_DBSet] PRIMARY KEY ([GroupName]) ); GO
EF Core version: Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer) Target framework: (e.g. .NET Core 3.0) Operating system: IDE: (e.g. Visual Studio 2019 16.3)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Looks like you are mixing SQLite and SQL Server migrations ??
Thanks a lot
Get Outlook for Androidhttps://aka.ms/ghei36
From: Shay Rojansky notifications@github.com Sent: Tuesday, September 8, 2020 8:37:22 PM To: dotnet/efcore efcore@noreply.github.com Cc: himanshukodwani himanshukodwani@hotmail.com; Author author@noreply.github.com Subject: Re: [dotnet/efcore] Column, parameter, or variable #1: Cannot specify a column width on data type text. (#22424)
You probably want to take a look at this doc pagehttps://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers?tabs=dotnet-core-cli, about managing migrations in a multi-database scenario.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/efcore/issues/22424#issuecomment-688941191, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJ7O4IUB427LSDURZBYKFI3SEZCCVANCNFSM4Q4X2S7A.