valdisiljuconoks / LocalizationProvider

Database driven localization provider for .NET applications (core assemblies)
Apache License 2.0
119 stars 38 forks source link

Schema update exception #292

Closed ellinge closed 1 month ago

ellinge commented 1 month ago

Hi, I get an exception when trying to upgrade an existing solution from 8.03/8.1.0 to 8.1.2

'The index 'IX_ResourceKey' is dependent on column 'ResourceKey'.
ALTER TABLE ALTER COLUMN ResourceKey failed because one or more objects access this column.'

Stacktrace

    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlConnection.OnError(Microsoft.Data.SqlClient.SqlException exception, bool breakConnection, System.Action<System.Action> wrapCloseInAction)  Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlInternalConnection.OnError(Microsoft.Data.SqlClient.SqlException exception, bool breakConnection, System.Action<System.Action> wrapCloseInAction)  Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(Microsoft.Data.SqlClient.TdsParserStateObject stateObj, Microsoft.Data.SqlClient.SqlCommand command, bool callerHasConnectionLock, bool asyncClose)    Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.TdsParser.TryRun(Microsoft.Data.SqlClient.RunBehavior runBehavior, Microsoft.Data.SqlClient.SqlCommand cmdHandler, Microsoft.Data.SqlClient.SqlDataReader dataStream, Microsoft.Data.SqlClient.BulkCopySimpleResultSet bulkCopyHandler, Microsoft.Data.SqlClient.TdsParserStateObject stateObj, out bool dataReady)   Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()    Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlDataReader.MetaData.get()  Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(Microsoft.Data.SqlClient.SqlDataReader ds, Microsoft.Data.SqlClient.RunBehavior runBehavior, string resetOptionsString, bool isInternal, bool forDescribeParameterEncryption, bool shouldCacheForAlwaysEncrypted)  Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior cmdBehavior, Microsoft.Data.SqlClient.RunBehavior runBehavior, bool returnStream, bool isAsync, int timeout, out System.Threading.Tasks.Task task, bool asyncWrite, bool inRetry, Microsoft.Data.SqlClient.SqlDataReader ds, bool describeParameterEncryptionRequest)  Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior cmdBehavior, Microsoft.Data.SqlClient.RunBehavior runBehavior, bool returnStream, System.Threading.Tasks.TaskCompletionSource<object> completion, int timeout, out System.Threading.Tasks.Task task, out bool usedCache, bool asyncWrite, bool inRetry, string method)    Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior cmdBehavior, Microsoft.Data.SqlClient.RunBehavior runBehavior, bool returnStream, string method)  Unknown
    [Exception] Microsoft.Data.SqlClient.dll!Microsoft.Data.SqlClient.SqlCommand.ExecuteScalar()    Unknown
    [Exception] DbLocalizationProvider.Storage.SqlServer.dll!DbLocalizationProvider.Storage.SqlServer.SchemaUpdater.SyncSchema(Microsoft.Data.SqlClient.SqlCommand cmd) Unknown
    [Exception] DbLocalizationProvider.Storage.SqlServer.dll!DbLocalizationProvider.Storage.SqlServer.SchemaUpdater.EnsureDatabaseSchema()  Unknown
    [Exception] DbLocalizationProvider.Storage.SqlServer.dll!DbLocalizationProvider.Storage.SqlServer.SchemaUpdater.Execute(DbLocalizationProvider.Sync.UpdateSchema.Command command)   Unknown
    [Exception] DbLocalizationProvider.dll!DbLocalizationProvider.Commands.Internal.CommandHandlerWrapper<TCommand>.Execute(DbLocalizationProvider.Abstractions.ICommand command)   Unknown
    [Exception] DbLocalizationProvider.dll!DbLocalizationProvider.CommandExecutor.Execute(DbLocalizationProvider.Abstractions.ICommand command) Unknown
    [Exception] DbLocalizationProvider.dll!DbLocalizationProvider.Sync.Synchronizer.UpdateStorageSchema()   Unknown
    [Exception] DbLocalizationProvider.dll!DbLocalizationProvider.Sync.Synchronizer.DiscoverReadMerge() Unknown
    [Exception] DbLocalizationProvider.dll!DbLocalizationProvider.Sync.Synchronizer.SyncResources(bool registerResources)   Unknown
    [Exception] DbLocalizationProvider.AspNetCore.dll!DbLocalizationProvider.AspNetCore.IServiceProviderExtensions.UseDbLocalizationProvider(System.IServiceProvider serviceFactory)    Unknown
    [Exception] DbLocalizationProvider.AspNetCore.dll!DbLocalizationProvider.AspNetCore.IApplicationBuilderExtensions.UseDbLocalizationProvider(Microsoft.AspNetCore.Builder.IApplicationBuilder builder)   Unknown
...
valdisiljuconoks commented 1 month ago

interesting. let me investigate more..

valdisiljuconoks commented 1 month ago

https://github.com/valdisiljuconoks/localization-provider-opti/issues/228

ellinge commented 1 month ago

Ok, not sure which package is causing the issue, should I close this as a duplicate?

valdisiljuconoks commented 1 month ago

that's fine. I'll close when done. no worries

ellinge commented 1 month ago

Seems to be this commit https://github.com/valdisiljuconoks/LocalizationProvider/commit/50ab0e49d6e5a3d512684b7102edbe160beb07da

ellinge commented 1 month ago

Probably worried about truncation with 1000 -> 800 or one have to drop existing index and add it back after updating the column.